Jump to content


Photo
- - - - -

Airvpn python client

client python linux

  • Please log in to reply
5 replies to this topic

#1 machavez

machavez

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 29 October 2017 - 12:40 PM

Hi,

 

I writed the following python script to connect to Airvpn and update DNS accordingly, etc. It is the first version and I did it mostly to practice a python (also now I'm not able to run eddie on gnome).

 

Any feedback just let me know, also if you have suggestions on how to do things better in python.

 

here the link: https://github.com/machavez84/airvpnConnect

 

Please read theREADME.me file.

 

Regards.



#2 giganerd

giganerd

    I shall have no title

  • Members
  • PipPipPip
  • 2445 posts
  • LocationGermany

Posted 07 November 2017 - 11:25 PM

def findDNS(file):
  dns = ""
  if "443" in file and "UDP" in file:
    dns = "10.4.0.1"
  elif "443" in file and "TCP" in file:
    dns = "10.5.0.1"
  elif "80" in file and "UDP" in file:
    dns = "10.6.0.1"
  elif "80" in file and "TCP" in file:
    dns = "10.7.0.1"
  elif "53" in file and "UDP" in file:
    dns = "10.8.0.1"
  elif "53" in file and "TCP" in file:
    dns = "10.9.0.1"
  elif "1194" in file and "UDP" in file:
    dns = "10.30.0.1"
  elif "1194" in file and "TCP" in file:
    dns = "10.50.0.1"
return dns

Shorten it; set 10.4.0.1 in all cases. Will still work. :)

 

def getRemoteHost(file):
  remote = ""
  if "AltEntry" in file:
    remote = "earth2.vpn.airdns.org"
  else:
    remote = "earth.vpn.airdns.org"
return remote

Expand this with a user prompt for a server or a geographic area, utilizing techniques in How can I get VPN servers IP addresses?.

 

Then give it a ncurses UI and incorporate the ability to add custom OpenVPN directives. Then implement Network Lock. Behold, an Eddie alternative. Don't listen to me, though :D

 

Nice work. :)


Always remember:
There's a guide to AirVPN,

Amazon IPs are not dangerous here,
running TOR exits is discouraged,

using spoilers for your logs is the proper way to heaven.
Same issues are rare! Search for solutions and if not successful open your own threads.

~ Furthermore, I propose that your paranoia is to be destroyed. ~

 


#3 machavez

machavez

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 12 November 2017 - 01:42 PM

Hehe, thanks Treiberschreiber,

 

I will enhance it if I have time. Just removed the chattr over /etc/Resolv.conf. I was setting the immutable flag because raspbian jessie was overwriting the file every time.

 

For the FindDNS() I just followed this rules --> https://airvpn.org/specs/

 

Regards.



#4 giganerd

giganerd

    I shall have no title

  • Members
  • PipPipPip
  • 2445 posts
  • LocationGermany

Posted 15 November 2017 - 02:12 PM

For the FindDNS() I just followed this rules --> https://airvpn.org/specs/

 

Yes, everyone finds this one. Staff once mentioned that the same DNS server is listening on all 10.x.0.1 addresses, so in the end I made my life easier and started using static 10.4.0.1 exclusively. This way I also avoided DNS request leaks entirely. On Windows, I needed to write a script to reenable DHCP DNS if I wanted or needed a break from the VPN.

 

On GNU/Linux it's even easier. I've got two network profiles set up in network-manager. One is DHCP and one is DHCP + AirDNS only. No leaks with the second one. Changing is also easier than ever. I love Linux.


Always remember:
There's a guide to AirVPN,

Amazon IPs are not dangerous here,
running TOR exits is discouraged,

using spoilers for your logs is the proper way to heaven.
Same issues are rare! Search for solutions and if not successful open your own threads.

~ Furthermore, I propose that your paranoia is to be destroyed. ~

 


#5 machavez

machavez

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 15 November 2017 - 10:23 PM

hehe, Debian user here!



#6 Iron_Mike

Iron_Mike

    Member

  • Members
  • PipPip
  • 25 posts

Posted 27 February 2018 - 12:07 PM

Hi guys,

 

I'm interested in writing a Python script for Windows that allows me to connect / disconnect AirVPN and connect to specific servers... could anybody elaborate on the general, top level approach here ?

 

So, it appears we cannot control the Eddie GUI client via Python, so we connect to an AirVPN server by creating a .ovpn file ?

 

Where would I get the .ovpn file that the script posted by machavez is asking for ?

 

Thanks.







Similar Topics Collapse


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users

Servers online. Online Sessions: 14803 - BW: 47188 Mbit/sYour IP: 54.162.163.181Guest Access.