Skip to content

Commit

Permalink
Update hackingtoolkit
Browse files Browse the repository at this point in the history
  • Loading branch information
shliu888 authored Jan 16, 2025
1 parent b3209ae commit 4ce9769
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions hackingtoolkit
Original file line number Diff line number Diff line change
Expand Up @@ -10,51 +10,51 @@ def the_harvester(domain, shodan,source,takeover):
if shodan=='-s' and source !='no':
if takeover=='-t':
try:
subprocess.run(['sudo','theHarvester','-d',domain,'-s','-t','-b',source],text=True,check_output=True)
subprocess.Popen(['sudo','theHarvester','-d',domain,'-s','-t','-b',source],text=True,check_output=True)
except subprocess.SubprocessError as error:
print('Encountered an error: ',str(error))
elif takeover=='no':
try:
subprocess.run(['sudo','theHarvester','-d',domain,'-s','-b',source],text=True,check_output=True)
subprocess.Popen(['sudo','theHarvester','-d',domain,'-s','-b',source],text=True,check_output=True)
except subprocess.SubprocessError as error:
print('Encountered an error: ',str(error))

elif shodan!='s' and source !='no':
if takeover=='-t':
try:
subprocess.run(['sudo','theHarvester','-d',domain,'-t','-b',source],check_output=True,text=True)
subprocess.Popen(['sudo','theHarvester','-d',domain,'-t','-b',source],check_output=True,text=True)
except subprocess.SubprocessError as error:
print('Encountered an error: ',str(error))
elif takeover=='no':
try:
subprocess.run(['sudo','theHarvester','-d',domain,'-b',source],check_output=True,text=True)
subprocess.Popen(['sudo','theHarvester','-d',domain,'-b',source],check_output=True,text=True)
except subprocess.SubprocessError as error:
print('Encountered an error: ',str(error))
elif shodan=='-s' and source=='no':
if takeover=='-t':
try:
subprocess.run(['sudo','theHarvester','-d',domain,'-s','-t'],check_output=True,text=True)
subprocess.Popen(['sudo','theHarvester','-d',domain,'-s','-t'],check_output=True,text=True)
except subprocess.SubprocessError as error:
print('Encountered an error: ',str(error))
elif takeover=='no':
try:
subprocess.run(['sudo','theHarvester','-d',domain,'-s'],check_output=True,text=True)
subprocess(['sudo','theHarvester','-d',domain,'-s'],check_output=True,text=True)
except subprocess.SubprocessEror as error:
print('Encountered an error: ',str(error))
elif shodan!='-s' and source=='no':
if takeover=='-t':
try:
subprocess.run(['sudo','theHarvester','-d',domain,'-t'],check_output=True,text=True)
subprocess(['sudo','theHarvester','-d',domain,'-t'],check_output=True,text=True)
except subprocess.SubprocessError as error:
print('Encountered an error: ',str(error))
elif takeover=='no':
try:
subprocess.run(['sudo','theHarvester','-d',domain],check_output=True,text=True)
subprocess(['sudo','theHarvester','-d',domain],check_output=True,text=True)
except subprocess.SubprocessError as error:
print('Encountered an eror: ',str(error))
def maltego():
try:
subprocess.run(['sudo','maltego'],text=True, capture_output=True)
subprocess(['sudo','maltego'],text=True, capture_output=True)
except subprocess.SubprocessError as error:
print('Encountered an error: ',str(error))

Expand Down Expand Up @@ -114,22 +114,22 @@ def osint():
#-------Zenmap------
def zenmap_menu():
try:
subprocess.run(['sudo','zenmap'],text=True, capture_output=True)
subprocess(['sudo','zenmap'],text=True, capture_output=True)
except subprocess.subprocessError as error:
print('Encountered error: ',str(error))

#-----------------------------------
def scan(nmap_choice,target,port_range,if_service_detection): # tcp scan
if not if_service_detection=='-sV':
try:
subprocess.run(['sudo','nmap',nmap_choice,'-p',str(port_range),str(target)],capture_output=True,text=True)
subprocess.Popen(['sudo','nmap',nmap_choice,'-p',str(port_range),str(target)],capture_output=True,text=True)
except subprocess.subprocessError as e:
print('Encountered an error: ',str(e))
except FileNotFoundError:
print("The tool 'nmap' is not installed or not in system PATH.")
if if_service_detection=='-sV':
try:
subprocess.run(['sudo','nmap',nmap_choice,if_service_detection,'-p',str(port_range),str(target)],text=True, capture_output=True)
subprocess(['sudo','nmap',nmap_choice,if_service_detection,'-p',str(port_range),str(target)],text=True, capture_output=True)
except subprocess.subprocessError as e:
print('Encountered an error: ',str(e))
except FileNotFoundError:
Expand Down Expand Up @@ -215,7 +215,7 @@ def recon():
#-----------------------------------
def crack_wifi_password(cap_file, wordlist):
try:
results = subprocess.run(['sudo', 'aircrack-ng', cap_file, '-w', wordlist], text=True, capture_output=True)
results = subprocess.Popen(['sudo', 'aircrack-ng', cap_file, '-w', wordlist], text=True, capture_output=True)
print(results.stdout)
except subprocessError as e:
print("Error: aircrack-ng encountered an error: str(e)")
Expand All @@ -234,7 +234,7 @@ def crunch_passwd(min_chars, max_chars, characters, pattern, filename): # use cr


try:
result = subprocess.run(command, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
result = subprocess.Popen(command, check_output=True, text=True)
print(result.stdout.decode())
except subprocess.CalledProcessError as e:
print("Error occurred:",e.stderr.decode())
Expand All @@ -245,7 +245,7 @@ def crunch_passwd(min_chars, max_chars, characters, pattern, filename): # use cr
def use_cupp():
try:
# Run the cupp tool using subprocess
subprocess.run(['sudo', 'cupp', '-i'])
subprocess(['sudo', 'cupp', '-i'])
except FileNotFoundError:
print("The 'cupp' tool is not installed or not in system PATH. ")
except Exception as e:
Expand Down Expand Up @@ -291,15 +291,15 @@ def captureHandshake(bssid, channel, filename, interface): # capture a four-way


try:
subprocess.run(command, check=True)
subprocess(command, check=True)
except subprocessError as e:
print("Error running airodump-ng: ",e)


def arpSpoof(interface,target_ip,router_ip): # ARP spoofing


subprocess.run(["sudo", "netdiscover", "-i", interface],text=True, capture_output=True)
subprocess.Popen(["sudo", "netdiscover", "-i", interface],text=True, capture_output=True)


with open("/proc/sys/net/ipv4/ip_forward", "w") as ip:
Expand All @@ -324,7 +324,7 @@ def deauthenticate(deauth_packets, bssid, client_mac, interface): #deauth attack
]


subprocess.run(command, check=True)
subprocess.Popen(command, check_output=True,text=True)
print("Deauthentication packets sent successfully.")
except subprocess.SubprocessError as e:
print("An error occurred while sending deauth packets:",str(e))
Expand All @@ -333,7 +333,7 @@ def deauthenticate(deauth_packets, bssid, client_mac, interface): #deauth attack
def capture_packets(bssid, channel, interface, filename): # targeted packet capture


subprocess.run(['iwconfig', interface, 'channel', str(channel)])
subprocess(['iwconfig', interface, 'channel', str(channel)])


print("Capturing packets on",interface,"for BSSID",bssid)
Expand Down Expand Up @@ -371,7 +371,7 @@ def sniff(interface): # start sniffing on all frequencies
command = ['sudo','airodump-ng', interface, '-abg']


subprocess.run(command, check=True)
subprocess(command, check=True)
except subprocess.SubprocessError as e:
print("An error occurred while running airodump-ng: ",str(e))
except FileNotFoundError:
Expand All @@ -382,7 +382,7 @@ def sniff(interface): # start sniffing on all frequencies
def monitor_mode(interface):
try:

subprocess.run(['sudo','airmon-ng', 'start', interface], check=True)
subprocess(['sudo','airmon-ng', 'start', interface], check=True)
print("Successfully started monitor mode on",interface,'\n')
except subprocess.CalledProcessError as e:
print("Failed to start monitor mode on ",interface,': ',e)
Expand All @@ -407,13 +407,13 @@ def wirelessAttack(): # selection of options for wireless attacks

try:

check_output = subprocess.run(command, capture_output=True, text=True, check=True)
check_output = subprocess.Popen(command, capture_output=True, text=True, check=True)
print("Processes that may interfere with airmon-ng:")
print(check_output.stdout)


kill_command = ["airmon-ng", "check", "kill"]
kill_output = subprocess.run(kill_command, capture_output=True, text=True, check=True)
kill_output = subprocess.Popen(kill_command, capture_output=True, text=True, check=True)


print(kill_output.stdout)
Expand Down

0 comments on commit 4ce9769

Please sign in to comment.