Skip to content

Incredibly fast crawler designed for OSINT.

interactive prompt for getting user input

Somdev Sangwan41f7f8c44e62
diff --git a/core/prompt.py b/core/prompt.py
new file mode 100644
index 0000000..24151ed
--- /dev/null
+++ b/core/prompt.py
@@ -0,0 +1,19 @@
+import os
+import tempfile
+
+def prompt(default=None):
+ editor = 'nano'
+ with tempfile.NamedTemporaryFile(mode='r+') as tmpfile:
+ if default:
+ tmpfile.write(default)
+ tmpfile.flush()
+
+ child_pid = os.fork()
+ is_child = child_pid == 0
+
+ if is_child:
+ os.execvp(editor, [editor, tmpfile.name])
+ else:
+ os.waitpid(child_pid, 0)
+ tmpfile.seek(0)
+ return tmpfile.read().strip()
\ No newline at end of file