-
Notifications
You must be signed in to change notification settings - Fork 20
/
fake_ap.py
133 lines (117 loc) · 5.01 KB
/
fake_ap.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#By SxNade
#https://github.com/SxNade/Rudrastra
#CONTRIBUTE
#START THE FAKE ACESS POINT***
from termcolor import colored
import sys
import os
import time
#importing the required Libraries
ap = '''
________________________________________________________________________________
____ __ ____
/ ) / / | / )
---/___ /-----------__-/---)__----__---__--_/_---)__----__--------/__|---/____/-
/ | / / / / / ) / ) (_ ` / / ) / ) === / | /
_/_____|__(___(__(___/___/_____(___(_(__)_(_ __/_____(___(______/____|_/________
'''
print(ap)
time.sleep(1)
print("\nRudrastra (v1.1) starting...\n")
time.sleep(0.5)
print(colored("[+]Configuring Fake AP now....!", "green", attrs=['bold']))
#Receiving the User Input For Properties of Access Point..
ssid = input(colored("[*] Enter The Broadcast Name For your Fake-AP: ", "red"))
ifc = input(colored("[*] Enter The Monitor mode Interface For your Fake-AP: ", "red"))
cl = input(colored("[*] Enter The Channel For your Fake-AP OR Type anything Between 1-14: ", "red"))
ask = input("\n\n[*]Do you want a Password for your Fake-AP..(Y/N)")
#Conditional Statement For Handelling Error In-case User INPUT is Invalid
if int(cl) > 14 or int(cl) < 1:
print(colored("[!]YOU ENTERED WRONG CHANNEL!!", "red", attrs=['bold']))
print(colored("[!]Exiting Now....", "red", attrs=['bold']))
sys.exit(0)
#A Function That will Both make the Fake-ap file and also run the Fake-ap..This Function will also ask the user If they want a OPEN Wifi or WPA2-Wifi
def ap_file():
if ask == "Y":
#Making Password a Global Variable as it is used in Inclosed in a Function Already and is Also Used in Other Two Functions Used For Creating the Fake-AP
global Password
Password = input(colored("[*] Enter The Password For your Fake-AP: "))
print(colored("\n[+]Making Fake-Ap config File...", "green"))
time.sleep(3)
make_pass_wifi_file()
print(colored("\n\n[+]FAKE AP READY TO DEPLOY!!", "green", attrs=['bold']))
check = input(colored("\n[!]Do you want to Run the Fake AP Now..(Y/N)", "red", attrs=['bold']))
if check == "Y":
start_fake_AP()
elif check == "N":
print(colored("[!]YOU SAID NO EXITING NOW...", "red", attrs=['bold']))
sys.exit(0)
elif ask == "N":
print(colored("\n[+]Making OPEN Fake-AP config file", "green", attrs=['bold']))
make_open_wifi_file()
print(colored("\n\n[+]FAKE AP READY TO DEPLOY!!", "green", attrs=['bold']))
check = input(colored("[*]Do you want to Run the Fake AP Now..(Y/N)", "red", attrs=['bold']))
if check == "Y":
start_fake_AP()
elif check == "N":
print(colored("[!]YOU SAID NO EXITING NOW...", "red", attrs=['bold']))
sys.exit(0)
#This Function will make File for a OPEN Wifi that is with no Password..!
def make_open_wifi_file():
file = open("hostapd.conf", 'w')
file.write(f"interface={ifc}")
file.write("\n")
file.write(f"ssid={ssid}")
file.write("\n")
file.write(f"channel={cl}")
file.write("\n")
file.write("hw_mode=g")
file.close()
#This Function will make a File for a WPA2 Wifi which has the Password Specified By the User..!
def make_pass_wifi_file():
file = open("hostapd.conf", 'w')
file.write(f"interface={ifc}")
file.write("\n")
file.write("driver=nl80211")
file.write("\n")
file.write(f"ssid={ssid}")
file.write("\n")
file.write("hw_mode=g")
file.write("\n")
file.write(f"channel={cl}")
file.write("\n")
file.write("macaddr_acl=0")
file.write("\n")
file.write("ignore_broadcast_ssid=0")
file.write("\n")
file.write("auth_algs=1")
file.write("\n")
file.write("wpa=2")
file.write("\n")
file.write(f"wpa_passphrase={Password}")
file.write("\n")
file.write("wpa_key_mgmt=WPA-PSK")
file.write("\n")
file.write("wpa_pairwise=CCMP")
file.write("\n")
file.write("wpa_group_rekey=86400")
file.write("\n")
file.write("ieee80211n=1")
file.write("\n")
file.write("wme_enabled=1")
file.close()
#This Function will Finally Run the FAKE-ACCESS-POINT
def start_fake_AP():
print(colored("<0>ONLINE", "green", attrs=['bold']))
os.system("hostapd hostapd.conf")
#Main Function That will Run the Whole Script
def main():
ap_file()
#Finally Calling the Main Function to Run the Program..!
main()
#This Function will be used Later in a UPDATE that will Be made SOON..!
def reset():
os.system("iptables --flush --table nat")
os.system("iptables --flush FORWARD")
os.system("echo 0 > /proc/sys/net/ipv4/ip_forward")
#alternative to reset shell script....LOL..!f**k it..!