Remove indentation inconsistencies

This commit is contained in:
Miguel Nogueira 2019-06-12 02:35:06 +01:00
parent 9773b3a5c7
commit c2a8d8b109
7 changed files with 257 additions and 60 deletions

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
</component>
</module>

4
.idea/misc.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6 (PythonVPNGateway)" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/PythonVPNGateway.iml" filepath="$PROJECT_DIR$/.idea/PythonVPNGateway.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

224
.idea/workspace.xml Normal file
View File

@ -0,0 +1,224 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="e692128d-c507-4123-b92b-96e6e5af92d3" name="Default Changelist" comment="" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileEditorManager">
<leaf>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="76">
<caret line="19" column="46" lean-forward="true" selection-start-line="19" selection-start-column="46" selection-end-line="19" selection-end-column="46" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/pyVPN.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="440">
<caret line="26" column="24" selection-start-line="26" selection-start-column="24" selection-end-line="26" selection-end-column="24" />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/.gitignore" />
<option value="$PROJECT_DIR$/LICENSE" />
<option value="$PROJECT_DIR$/pyVPN.py" />
<option value="$PROJECT_DIR$/.env" />
<option value="$PROJECT_DIR$/README.md" />
</list>
</option>
</component>
<component name="ProjectConfigurationFiles">
<option name="files">
<list>
<option value="$PROJECT_DIR$/.idea/vcs.xml" />
</list>
</option>
</component>
<component name="ProjectFrameBounds" extendedState="7">
<option name="x" value="260" />
<option name="y" value="20" />
<option name="width" value="1400" />
<option name="height" value="997" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="PythonVPNGateway" type="b2602c69:ProjectViewProjectNode" />
<item name="PythonVPNGateway" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="ASKED_SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="settings.editor.selected.configurable" value="editor.preferences.fonts.default" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="e692128d-c507-4123-b92b-96e6e5af92d3" name="Default Changelist" comment="" />
<created>1560275194845</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1560275194845</updated>
</task>
<task id="LOCAL-00001" summary="First commit. &#10;Untested, following commits will be fixes.">
<created>1560277848439</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1560277848439</updated>
</task>
<task id="LOCAL-00002" summary="Add Readme and License.&#10;Testing ensues.">
<created>1560278425713</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1560278425713</updated>
</task>
<task id="LOCAL-00003" summary="Make process path dynamic">
<created>1560287808394</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1560287808394</updated>
</task>
<option name="localTasksCounter" value="4" />
<servers />
</component>
<component name="ToolWindowManager">
<frame x="0" y="0" width="1920" height="1037" extended-state="7" />
<editor active="true" />
<layout>
<window_info id="Favorites" side_tool="true" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.18133895" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Version Control" />
<window_info anchor="bottom" id="Python Console" weight="0.32963374" />
<window_info anchor="bottom" id="Terminal" weight="0.32852387" />
<window_info anchor="bottom" id="Event Log" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
</layout>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="First commit. &#10;Untested, following commits will be fixes." />
<MESSAGE value="Add Readme and License.&#10;Testing ensues." />
<MESSAGE value="Make process path dynamic" />
<option name="LAST_COMMIT_MESSAGE" value="Make process path dynamic" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/venv/lib/python3.6/site-packages/pexpect/spawnbase.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-9">
<caret line="239" column="8" selection-start-line="239" selection-start-column="8" selection-end-line="239" selection-end-column="8" />
</state>
</provider>
</entry>
<entry file="file:///usr/lib/python3.6/asyncio/unix_events.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="291">
<caret line="540" column="8" selection-start-line="540" selection-start-column="8" selection-end-line="540" selection-end-column="8" />
</state>
</provider>
</entry>
<entry file="file:///usr/lib/python3.6/base64.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="11" lean-forward="true" selection-start-line="11" selection-end-line="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="6" lean-forward="true" selection-start-column="6" selection-end-column="6" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/LICENSE">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="6" column="61" selection-start-line="6" selection-start-column="61" selection-end-line="6" selection-end-column="61" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/.env">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="45" lean-forward="true" selection-start-column="45" selection-end-column="45" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="76">
<caret line="19" column="46" lean-forward="true" selection-start-line="19" selection-start-column="46" selection-end-line="19" selection-end-column="46" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pyVPN.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="440">
<caret line="26" column="24" selection-start-line="26" selection-start-column="24" selection-end-line="26" selection-end-column="24" />
</state>
</provider>
</entry>
</component>
</project>

View File

@ -1,55 +0,0 @@
#!/usr/bin/env python3
import os
import sys
import pexpect
import os.path
import base64
# This script can probably use some improvement
process = os.environ['PYVPN_PROCESS_PATH']
operatingDir = "/root"
fScript = pexpect.spawn("/bin/bash" + process)
if len(sys.argv) > 2:
if sys.argv[2] == "--create-client":
clientName = sys.argv[3]
configFilePath = operatingDir + "/" + clientName + ".ovpn"
fScript.expect(r'/(?:Select\ an\ option\ \[1\-4\]\:)/')
fScript.sendline('1')
fScript.expect(r'(?:Client\ name\:)')
fScript.sendline(clientName)
fScript.kill(0)
if os.path.exists(configFilePath):
file = open(configFilePath, 'r')
finalResult = base64.b64encode(file.read())
sys.stdout.write(finalResult)
sys.stdout.flush()
sys.exit(0)
else:
sys.stdout.write("Error! OpenVPN did not create the Configuration file.")
sys.stdout.flush()
sys.stdout.exit(1)
else:
sys.stdout.write("Error! Missing options!")
sys.stdout.flush()
sys.stdout.exit(2)
else:
sys.stdout.write("Error! Missing client name!")
sys.stdout.flush()
sys.stdout.exit(3)

7
pyvpn
View File

@ -24,12 +24,9 @@ if len(sys.argv) > 2:
configFilePath = operatingDir + "/" + clientName + ".ovpn"
fScript.expect("[1-4]:")
fScript.expect("[1-4]:")
fScript.sendline("1")
fScript.expect("Client name: ")
fScript.expect("Client name: ")
fScript.sendline(clientName)
fScript.kill(0)