<commit_before>#!/usr/bin/env python

def main():
	import configparser
	import sys, os

	# error cases
	if len(sys.argv) != 3:
		print("Error, wrong arguments! Use pptool.py instead.")
		sys.exit()
	if os.getuid() != 0:
		print("Error: This function needs root permissions!")
		sys.exit()

	filename = str(sys.argv[1])
	newserver = str(sys.argv[2])

	vpnconf = configparser.RawConfigParser()
	vpnconf.read(filename)
	gateway = vpnconf.get("vpn", "gateway")

	if gateway != newserver:
		# Set new server
		print("Changing PP server from " + gateway + " to " + newserver)
		vpnconf.set("vpn", "gateway", newserver)
		
		with open(filename, 'w') as configfile:
			vpnconf.write(configfile)
		print("New Server written to configuration.")
	else:
		sys.exit()

if __name__ == '__main__':
        main()<commit_msg>openvpn support added<commit_after>#!/usr/bin/env python

def main():
	import configparser
	import sys, os

	# error cases
	if len(sys.argv) != 3:
		print("Error, wrong arguments! Use pptool.py instead.")
		sys.exit()
	if os.getuid() != 0:
		print("Error: This function needs root permissions!")
		sys.exit()

	fileName = str(sys.argv[1])
	newServer = str(sys.argv[2])

	vpnconf = configparser.RawConfigParser()
	vpnconf.read(fileName)
	
	# get vpn type
	serverString = "gateway"
	sType = vpnconf.get("vpn", "service-type")
	if sType.endswith(".openvpn"):
		serverString = "remote"
	elif not sType.endswith(".pptp"):
		print("Warning: Unsupported VPN-Type! (" + sType + ") Please use pptp or openvpn.")
	
	# get old server
	oldServer = vpnconf.get("vpn", serverString)

	if oldServer != newServer:
		# Set new server
		print("Changing PP server from " + oldServer + " to " + newServer)
		vpnconf.set("vpn", serverString, newServer)
		
		with open(fileName, 'w') as configfile:
			vpnconf.write(configfile)
		print("New Server written to configuration.")
	else:
		sys.exit()

if __name__ == '__main__':
        main()
{'fraction_non_alphanumeric': 0.14649350649350648, 'fraction_numerical': 0.004155844155844156, 'mean_word_length': 4.08179419525066, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6769007', 'n_tokens_mistral': 726, 'n_tokens_neox': 674, 'n_words': 176}