aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2022-08-15 09:10:19 +0530
committerRaghuram Subramani <raghus2247@gmail.com>2022-08-15 09:10:19 +0530
commit2ad193bf35ea3eca519473609d8822ad3ce2cfd9 (patch)
tree95b1f01c980906c4374b75f9e84fffa390688be1
parent2a9babfc5bfbba72cea84f641b92e5c790fc7fd5 (diff)
add files
-rw-r--r--README.md2
-rw-r--r--ipman.gifbin0 -> 1075034 bytes
-rwxr-xr-xipman.py64
3 files changed, 66 insertions, 0 deletions
diff --git a/README.md b/README.md
index 447eba0..8d030af 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,4 @@
# ipman
Tired of copying and pasting the IP address while playing a CTF?
+
+<img src="ipman.gif" alt="demo">
diff --git a/ipman.gif b/ipman.gif
new file mode 100644
index 0000000..e7318fe
--- /dev/null
+++ b/ipman.gif
Binary files differ
diff --git a/ipman.py b/ipman.py
new file mode 100755
index 0000000..5c3e61c
--- /dev/null
+++ b/ipman.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python3
+from pynput import keyboard
+from pynput.keyboard import Controller
+import gi
+from time import sleep
+import sys
+
+try:
+ option = sys.argv[1]
+except IndexError:
+ print(f"Usage: python3 {sys.argv[0]} [paste]/[setip]")
+
+gi.require_version("Gtk", "3.0")
+from gi.repository import Gtk, GLib
+
+pastekey = Controller()
+
+class EntryWindow(Gtk.Window):
+ def __init__(self):
+ super().__init__(title="Enter The IP Address.")
+ self.set_size_request(250, 47)
+
+ self.timeout_id = None
+
+ vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
+ self.add(vbox)
+
+ self.entry = Gtk.Entry()
+ vbox.pack_start(self.entry, True, True, 0)
+ self.entry.connect("activate", self.onok)
+
+ hbox = Gtk.Box(spacing=6)
+ vbox.pack_start(hbox, True, True, 0)
+
+ def onok(self, widget):
+ global currentip
+ with open("/tmp/tempaddr", "w") as h:
+ h.write(widget.get_text())
+ self.destroy()
+
+def prompt():
+ win = EntryWindow()
+ win.connect("destroy", Gtk.main_quit)
+ win.show_all()
+ Gtk.main()
+
+def paste(text):
+ pastekey.type(text)
+
+def main():
+ if option == "paste":
+ try:
+ with open("/tmp/tempaddr", "r") as h:
+ paste(h.read().strip())
+ except:
+ pass
+ elif option == "setip":
+ prompt()
+
+if __name__ == "__main__":
+ try:
+ main()
+ except:
+ pass \ No newline at end of file