PK!Y[mullvad_python/__init__.py"""Initialization package.""" from .api import Mullpy from .banner import banner __all__ = ['Mullpy', 'banner'] __version__ = '0.3.0' PK!= eemullvad_python/api.py"""Module holding Mullpy class.""" from requests import get as rget from .dns_leak import dnsleak_results class Mullpy(): """Mullpy class methods. Initialize requesting basic data about yourself to see if you're connected to Mullvad's servers. isblacklisted(): Return a bool if you're blacklisted. blacklist_information: Return information if you're blacklisted under Spamhouse or Project Honeypot. check_port(): Check if your port is reachable. """ def __init__(self): """Request API data and initialize them.""" self.api_data = rget('https://am.i.mullvad.net/json').json() self.ip = self.api_data['ip'] self.country = self.api_data['country'] self.city = self.api_data['city'] self.longitude = self.api_data['longitude'] self.latitude = self.api_data['latitude'] self.exit_ip = self.api_data['mullvad_exit_ip'] if self.exit_ip: self.exit_hostname = self.api_data['mullvad_exit_ip_hostname'] self.organization = self.api_data['organization'] self.server_type = self.api_data['mullvad_server_type'] self.blacklisted = self.api_data['blacklisted'] def is_blacklisted(self): """Return True or False if user is blacklisted.""" is_blacklisted = self.blacklisted['blacklisted'] return is_blacklisted def blacklist_information(self): """Return blacklisted information.""" blacklist_info = self.blacklisted['results'] return blacklist_info @staticmethod def is_leaking(): """Check if user is leaking DNS data.""" return dnsleak_results() @staticmethod def check_port(port): """Ony check if port is open.""" req_port = rget(f'https://am.i.mullvad.net/port/{port}').json() is_open = req_port['reachable'] return is_open PK!<,mullvad_python/banner.pybanner = r''' \ | | | |\/ | | | | | __ \ | | | | | | | | | | | | _| _| \__,_| _| _| .__/ \__, | _| ____/ v0.3.0 ''' PK!][>ZBBmullvad_python/cli.py"""Command Line Interface module.""" import click from .api import Mullpy from .banner import banner @click.command() @click.option('--dns', '-l', is_flag=True) @click.option('--port', '-p', type=int, default=0) def main(dns, port=0): """CLI for Mullvad API.""" mullpy = Mullpy() if mullpy.exit_ip: text_color = 'green' else: text_color = 'red' click.secho(banner, fg=text_color, bold=True) # Using Mullvad's exit IP? print('Using Mullvad:', end='\t') if mullpy.exit_ip: click.secho('True', fg=text_color, bold=True) print('Server Type:', end='\t') click.secho(mullpy.server_type, fg=text_color, bold=True) else: click.secho("FALSE. INSECURE CONNECTION!", fg=text_color, bold=True) # IP Address print('IP Address:', end='\t') click.secho(mullpy.ip, fg=text_color, bold=True) # Country / City print('Country:', end='\t') click.secho(f'{mullpy.city}, {mullpy.country}', fg=text_color, bold=True) # Longitude / Latitude print(f'Location:', end='\t') longitude, latitude = mullpy.longitude, mullpy.latitude click.secho(f'{longitude}, {latitude}', fg=text_color, bold=True) # Organization if mullpy.exit_ip: print('Organization:', end='\t') click.secho(mullpy.organization, fg=text_color, bold=True) # Blacklisted? print('Blacklisted: ', end='\t') if mullpy.is_blacklisted(): click.secho('True', fg='red', bold=True) else: click.secho('False', fg='green', bold=True) # Dns Leak results from bash.ws if dns: print('DNS Leak: ', end='\t') if mullpy.is_leaking(): click.secho('True', fg='red', bold=True) else: click.secho('False', fg='green', bold=True) # Check if port is open if port: print(f'Port {port}: ', end='\t') if mullpy.check_port(port): click.secho('Open', fg='green', bold=True) else: click.secho('Closed', fg='red', bold=True) print() exit(0) if __name__ == '__main__': main(None) PK!psmullvad_python/dns_leak.py"""Module to test for DNS leak in bash.ws.""" from os import system from random import randint from requests import get as rget def do_fake_ping(bashws_id, count=3): """Do fake dns requests to provide to bash.ws.""" api_domain = 'bash.ws' for ping_count in range(count): full_domain = f'{ping_count}.{bashws_id}.{api_domain}' system(f'ping -c 1 {full_domain} > /dev/null 2>&1') def dnsleak_results(): """Return a bool if dns leak results are positive or negative.""" bashws_id = randint(1000000, 9999999) do_fake_ping(bashws_id) results = rget(f'https://bash.ws/dnsleak/test/{bashws_id}?json').json() if results[2]['ip'] == 'DNS is not leaking.': return False return True PK!H~ 12/mullvad_python-0.3.0.dist-info/entry_points.txtN+I/N.,()-)Qe)%yz9Vy\\PK!~fHH)mullvad_python-0.3.0.dist-info/LICENSE.mdMIT License Copyright (c) [2018] [Robertho Franchesko Orozco Parrales] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK!HlŃTT$mullvad_python-0.3.0.dist-info/WHEEL A н#J@Z|Jmqvh&#hڭw!Ѭ"J˫( } %PK!HwM 'mullvad_python-0.3.0.dist-info/METADATAVkr6mbvFF"eIrSƯd\H@)_=AO ]a;Do? +TZd=gGgQA'M(v+uNgqU>9puz L 6da?;)ИT\w&LM_TQҵNeDO'oNFAߊ‰}Yt0")G?2,L%;_3PwNF=;րڍb*<*9SMfkvr߈H>kь zDZ5 iQdcJB TVÇC="Z֡4.5MN=fKy;޹oϳy'Ϫ;k_yy.kG. Q.%Ъ죕 !;GEVRa\UNa'he^xve:2Wix~jކDyԂJh3$2n0:Oj7›Lɔx쐽?q1>4-8;av dʨ^'I&3M1HFz3@IЮ{8ʔe, …j&t,^3yV݄B׳ "*cA>LZT.a($Jj=Ÿۄ޸I6f;rmM͈PK!Hɞ;%mullvad_python-0.3.0.dist-info/RECORDA0y@Pqz?ʯzE]Ғ~#D(a Ф4IJ\SǬ_7ieՒg6s8b(pU/FyETv/nhϨdq85r1ɯ#Qw-(=^@9i,T?yD:$ {̀ʕe˹ϯJ7a % ⇖Znrv:UK0Aj퐏U#w C8C8Ä4l@>Sv{$5CvgϘ_6S_;KkYUjv^U\RlK361,KQkJ%VQogWo8m] akA?{Mð8V Dkwɪ0f~OHib[1>6ZBBY mullvad_python/cli.pyPK!psmullvad_python/dns_leak.pyPK!H~ 12/mullvad_python-0.3.0.dist-info/entry_points.txtPK!~fHH)dmullvad_python-0.3.0.dist-info/LICENSE.mdPK!HlŃTT$mullvad_python-0.3.0.dist-info/WHEELPK!HwM 'mullvad_python-0.3.0.dist-info/METADATAPK!Hɞ;%r mullvad_python-0.3.0.dist-info/RECORDPK "