Skip to content

Wifi-Info-PY --- Details

Compare
Choose a tag to compare
@suchsoak suchsoak released this 05 Nov 21:09
· 25 commits to main since this release
0c73e26
               __       __ ______ ________ ______      ______ __    __ ________  ______  
           |  \  _  |  \      \        \      \    |      \  \  |  \        \/      \ 
           | ▓▓ / \ | ▓▓\▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓\▓▓▓▓▓▓     \▓▓▓▓▓▓ ▓▓\ | ▓▓ ▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓
           | ▓▓/  ▓\| ▓▓ | ▓▓ | ▓▓__     | ▓▓        | ▓▓ | ▓▓▓\| ▓▓ ▓▓__   | ▓▓  | ▓▓
           | ▓▓  ▓▓▓\ ▓▓ | ▓▓ | ▓▓  \    | ▓▓        | ▓▓ | ▓▓▓▓\ ▓▓ ▓▓  \  | ▓▓  | ▓▓
           | ▓▓ ▓▓\▓\▓| ▓▓ | ▓▓▓▓▓    | ▓▓        | ▓▓ | ▓▓\▓▓ ▓▓ ▓▓▓▓▓  | ▓▓  | ▓▓
           | ▓▓▓▓  \▓▓▓▓_| ▓▓_| ▓▓      _| ▓▓_      _| ▓▓_| ▓▓ \▓▓▓▓ ▓▓     | ▓▓__/ ▓▓
           | ▓▓▓    \▓▓▓   ▓▓ \ ▓▓     |   ▓▓ \    |   ▓▓ \ ▓▓  \▓▓▓ ▓▓      \▓▓    ▓▓
            \▓\▓\▓▓▓▓▓▓\▓\▓▓▓▓▓▓     \▓▓▓▓▓▓\▓\▓\▓\▓▓▓▓▓▓
           
                   ⠠⠞⠑⠭⠞⠶⠠⠑⠙⠊⠞⠕⠗Github: https://github.com/suchsoak⠠⠞⠑⠭⠞⠶⠠⠑⠙⠊⠞⠕⠗
                                            BY:suchsoak
                                              v:1.0.2

Details

wifi = ['inet', 'netmask', 'device', 'inet4', 'netmasks', 'broadcast', 'broadcasts']

# Information

for interface in interfaces.values():
        if all(key in interface for key in wifi):
            if all(interface) is not None:
                print ("Inet:                   ",interface['inet'])
                print ("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")
                colorama.init()
                print(Fore.MAGENTA)
                print ("Device:                 ",interface['device'])    
                print ("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")
                print(Style.RESET_ALL)
                print ("Inet4:                  ",interface['inet4']) 
                print ("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")
                print ("Inet6:                  ",interface['inet6']) 
                print ("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")
                print ("Netmask:                ",interface['netmask'])
                print ("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")
                print ("Netmasks:               ",interface['netmasks'])
                print ("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")
                print ("Broadcast:              ",interface['broadcast'])
                print ("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")
                print ("Broadcasts:             ",interface['broadcasts'])
                print ("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")

The provided script retrieves information about the Wi-Fi network interfaces of the system.

First, it initializes an empty list called 'wifi'.

Next, it iterates over each interface in the 'interfaces' dictionary. If the current interface contains all the keys listed in the 'wifi' list and if all the values for these keys are not None, the script proceeds to print the relevant network information for the interface.

Here is the specific output provided by the script for each interface:

The IPv4 address ('inet').
The name of the network interface device ('device').
The IPv6 address ('inet6').
The subnet mask ('netmask').
The broadcast address ('broadcast').
Additionally, the script uses the 'colorama' module to color the printed network interface device name.

Family Information

for interface, addresses in add.items():
    print(f"Interface: {interface}")
    for address in addresses:
        print("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")
        print("Family:", address.family)
        print("Address:", address.address)
        time.sleep(2)
        print("Netmask:", address.netmask)
        print("Broadcast:", address.broadcast)

This script displays the IPv4 and IPv6 addresses, Inetmasks, and broadcast addresses for each network interface on the system.

To do this, it iterates over the dictionary items in 'add', where each key represents a network interface and each value is a list of IP address objects for that interface.

For each interface, the script first prints the name of the interface and then iterates over the list of IP address objects for that interface.

For each IP address object, the script prints the family of the IP address (either 'inet' for IPv4 or 'inet6' for IPv6), the IP address itself, the netmask, and the broadcast address.

After printing all the information for an interface, the script waits for 2 seconds before proceeding to the next interface. This provides a convenient way to pause and review the output for each interface.

This script can be helpful for understanding and troubleshooting network connectivity issues.

Other Wifi Information

for device in wifi_info:
    try:
        wifi_mode = device.mode
        wifi_bssid = device.bssid
        print()
        wifi_ssid = device.ssid
        print()
        time.sleep(3)
        wifi_signal = device.signal
        wifi_cha = device.chan
        wifi_frequency = device.freq
        wifi_security = device.security
        
        print(f"WiFi Mode: {wifi_mode}")
        print(f"BSSID: {wifi_bssid}")
        colorama.init()
        print(Fore.MAGENTA)
        print(f"SSID: {wifi_ssid}")
        print(Style.RESET_ALL)
        print(f"Signal Strength: {wifi_signal}")
        print(f"WiFi Chang: {wifi_cha}")
        print(f"wifi Frequency: {wifi_frequency}")
        print(f"wifi Security: {wifi_security}")
        print()
    except Exception as error:
        print(f"Error: {error}")

This script gathers and prints the Wi-Fi connection details of each device on the network.

To understand the script's logic, we can break it down step by step:

The script iterates over each device in the 'wifi_info'list.

For each device, the script attempts to retrieve various Wi-Fi details, such as the Wi-Fi mode, BSSID, SSID, signal strength, channel, frequency, and security type.

After successfully retrieving the Wi-Fi details for a device, the script prints these details to the console.

If the script encounters an error while trying to retrieve a device's Wi-Fi details, it catches the error and prints the error message to the console.

After printing the Wi-Fi details for a device, the script waits for 3 seconds before proceeding to the next device.

By following these steps, the script gathers and prints the Wi-Fi connection details for each device on the network

Note

This script is specifically designed for networks where devices can connect via Wi-Fi. If the network uses a different type of connection, such as Ethernet, the script would not be able to gather Wi-Fi details for those devices.

Firewall Test

try:

    r = requests.get('https://www.torproject.org/')
    proxy = requests.get('https://www.proxysite.com/')
    vpnproton = requests.get('https://protonvpn.com/')
    r.status_code

    if r.status_code == 200:
        colorama.init()
        print(Fore.MAGENTA)
        print("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")
        print()
        print("Tor is not blocked!", "Status Code: " ,r.status_code)
        print()
        print("Proxy is not blocked!", "Status Code: " ,proxy.status_code)
        print()
        print("Vpnproton is not blocked!", "Status Code: " ,vpnproton.status_code)
        print()
        print("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")
        print(Style.RESET_ALL) 

    elif r.status_code == 403:
        print("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")
        print()
        print("Tor is not found", "Status Code: " ,r.status_code)
        print()
        print("Proxy is not found!", "Status Code: " ,proxy.status_code)
        print()
        print("vpnproton is not found!", "Status Code: " ,vpnproton.status_code)
        print()
        print("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")

    elif r.status_code == 503:
        print("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")
        print()
        print("Tor is not found", r.status_code)
        print()
        print("Proxy is not found!", "Status Code: " ,proxy.status_code)
        print()
        print("vpnproton is not found!", "Status Code: " ,vpnproton.status_code)
        print()
        print("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")
        
    else:
        colorama.init()
        print(Fore.RED)
        print("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")
        print()
        print("Tor rejected, bocked for firewall: ", r.status_code)
        print()
        print("Proxy blocked for firewall", "Status Code: " ,proxy.status_code)
        print()
        print("vpnproton blocked for firewall", "Status Code: " ,proxy.status_code)
        print()
        print("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")
        print(Style.RESET_ALL)
except Exception as e:
    print(e)

This script is designed to check the availability of Tor,proxy and Proton_vpn connections on the internet.

Here's the step-by-step explanation of the script:

The script sends an HTTP GET request to the Tor website URL ('https://www.torproject.org/') using the requests.get() function.

Similarly, the script sends an HTTP GET request to the Proxy Site website URL ('https://www.proxysite.com/') using the requests.get() function.

The script sends an HTTP GET request to the Tor website URL ('https://protonvpn.com/') using the requests.get() function.

The response status code for the HTTP GET request is obtained using the r.status_code attribute.

If the response status code is 200, it means that Tor and proxy connections are not blocked, and the script prints this information along with the status code.

If the response status code is 403, it means that the Tor and proxy websites are not found, and the script prints this information along with the status code.

If the response status code is 503, it means that the Tor and proxy websites are not found, and the script prints this information along with the status code.

If the response status code is neither 200, 403, nor 503, it means that Tor and proxy connections are rejected, possibly due to a firewall, and the script prints this information along with the status code.

The script is written in Python, which is a widely used programming language known for its simplicity and readability.

In conclusion, this script checks the availability of Tor and proxy connections on the internet and prints the results to the console.

Speed teste

   s = speedtest.Speedtest()
    s.get_best_server()
    s.download()
    s.upload()

    speed = s.results

    print("")

    colorama.init()

    print(Fore.MAGENTA)

    Speedtest = '''
    .−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−.
    | ⠠⠞⠑⠭⠞⠶⠠⠑⠙⠊⠞⠕⠗Speed teste⠠⠞⠑⠭⠞⠶⠠⠑⠙⠊⠞⠕⠗ | 
    '−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−'
    '''
    print(Speedtest)
    print(Style.RESET_ALL) 
    print("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")
    print("Download:", speed.download / 1024 / 1024, "Mbps")
    print("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")
    print("Upload:", speed.upload / 1024 / 1024, "Mbps")
    print("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")
    print("Ping:", speed.ping, "ms")
    print("−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−")
    print("Server:", speed.server['sponsor'])

The script performs a speed test using the speedtest-cli package.

Here is a breakdown of the script:

We create a speedtest object, which allows us to perform speed tests.
We retrieve the best server to perform the speed test on.
We perform the download speed test and retrieve the results.
We perform the upload speed test and retrieve the results.
We calculate the download and upload speeds in Mbps (Megabits per second).
We display the speed test results, including the download speed, upload speed, ping time, server sponsor, and server ID.
The speedtest-cli package provides a simple way to test internet speed. The results of the speed test can be useful for diagnosing internet connection issues or comparing different internet service providers.

In this script, we use the colorama library to add colors to the output. The colorama.init() function initializes the colorama library. We then use the Fore module from colorama to set the color of the text to magenta. Finally, we reset the color to its default using the Style.RESET_ALL module from colorama.