diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | ipman.gif | bin | 0 -> 1075034 bytes | |||
-rwxr-xr-x | ipman.py | 64 |
3 files changed, 66 insertions, 0 deletions
@@ -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 Binary files differnew file mode 100644 index 0000000..e7318fe --- /dev/null +++ b/ipman.gif 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 |