- Move single-file tools to tools/ organized by category (security, forensics, data, etc.) - Move multi-file projects to projects/ (go-tools, puzzlebox, timesketch, rust-tools) - Move system scripts to scripts/ (proxy, display, setup, windows) - Organize config files in config/ (shell, visidata, applications) - Move experimental tools to archive/experimental - Create 'what' fuzzy search tool with progressive enhancement (ollama->fzf->grep) - Add initial metadata database for intelligent tool discovery - Preserve git history using 'git mv' commands
36 lines
971 B
Python
36 lines
971 B
Python
#!/usr/bin/env python
|
|
|
|
# banner.py
|
|
|
|
import sys
|
|
import socket
|
|
import argparse
|
|
|
|
def grab(ip, port):
|
|
"""Connects to the specified IP and port, retrieves data and returns the decoded response."""
|
|
try:
|
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # TCP
|
|
sock.settimeout(5) # Set a timeout of 5 seconds
|
|
sock.connect((ip, port))
|
|
ret = sock.recv(1024)
|
|
return ret.strip().decode()
|
|
except socket.error as e:
|
|
return f"Connection error: {e}"
|
|
finally:
|
|
sock.close()
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description="Retrieve banner information from the specified IP and port.")
|
|
parser.add_argument("ip", help="The target IP address")
|
|
parser.add_argument("-p", "--port", type=int, default=25, help="The target port (default: 25)")
|
|
|
|
args = parser.parse_args()
|
|
|
|
ip = args.ip
|
|
port = args.port
|
|
|
|
print(grab(ip, port))
|
|
|
|
if __name__ == "__main__":
|
|
main()
|