69
69
LOG_VERBOSE = 5
70
70
LOG_DEBUG = 10
71
71
72
+ import os
73
+ import pickle
74
+ import select
75
+ import socket
76
+ import StringIO
77
+ import struct
78
+ import subprocess
79
+ import sys
80
+ import time
81
+ import threading
82
+ if sys .platform != 'win32' :
83
+ import fcntl
84
+ from ifaceconfiglib import cfg
85
+
72
86
# -------------------------------------------------------------------
73
- # CONFIGURATION (please set this up before first use )
87
+ # CONFIGURATION (set values from config file )
74
88
# -------------------------------------------------------------------
75
89
76
- # Put some random string here. It will be used as poor man's authentication.
77
- # Please put the same string in ifaceclientlib.py
78
- SECRET = ""
79
-
80
- # Specify your default, fallback home directory at VM
81
- HOME_PATH_ON_VM = "/home/gynvael"
90
+ SECRET = cfg .get ('main' , 'secret' )
91
+ HOME_PATH_ON_VM = cfg .get ('main' , 'home_path' )
92
+ BIND_PORT = cfg .getInt ('main' , 'bind_port' )
93
+ TERMINAL_CMD = cfg .get ('main' , 'terminal_cmd' )
94
+ REMOTE_IP_LIST = eval (cfg .get ('main' , 'remote_ip_list' ))
82
95
83
96
CMDS = {
84
97
"iface-info" : "CMD_iface_info" , # Returns some info.
88
101
"translate-path" : "CMD_translate_path" , # Translates path.
89
102
}
90
103
91
- # TODO move this to some kind of config.
92
- # TODO do the same in ifaceclientlib.py
93
- # IPs of HOST and VM (in that order)
94
- REMOTE_IP_LIST = ( "192.168.56.1" , "192.168.56.3" )
95
- BIND_PORT = 33321
96
-
97
104
LOG_LEVEL = LOG_DEBUG
98
-
99
105
# -------------------------------------------------------------------
100
106
# End of constants / configs.
101
107
# -------------------------------------------------------------------
102
108
103
- import os
104
- import pickle
105
- import select
106
- import socket
107
- import StringIO
108
- import struct
109
- import subprocess
110
- import sys
111
- import time
112
- import threading
113
- if sys .platform != 'win32' :
114
- import fcntl
115
-
116
109
print "Windows/Linux iface by gynvael.coldwind//vx"
117
110
118
111
def Usage ():
@@ -123,8 +116,7 @@ def Usage():
123
116
if len (SECRET ) == 0 :
124
117
print "This is your time running Windows/Linux iface. You first need to set "
125
118
print "some things up before you can use it."
126
- print "Please open iface.py and ifaceclientlib.py and read the top comments on"
127
- print "how to begin."
119
+ print "Please open iface.cfg and set needed values."
128
120
sys .exit (1 )
129
121
130
122
if len (sys .argv ) != 2 :
@@ -1348,7 +1340,7 @@ def translate_path_to_linux(path):
1348
1340
if not path [0 ].upper () in ['C' , 'D' , 'E' , 'I' , 'W' , 'B' ]:
1349
1341
1350
1342
# Nothing we can do.
1351
- path = "/home/gynvael/"
1343
+ path = HOME_PATH_ON_VM
1352
1344
1353
1345
# Done.
1354
1346
Log (LOG_INFO , "translate-path: [!] \" %s\" -> \" %s\" " % (
@@ -1472,7 +1464,7 @@ def CMD_l_cmd(info, cwd):
1472
1464
1473
1465
# Spawn the terminal.
1474
1466
cwd = cwd .replace ("'" , "\\ '" )
1475
- command = "(cd '%s'; /usr/local/bin/gnome-terminal &)" % cwd
1467
+ command = "(cd '%s'; %s &)" % ( cwd , TERMINAL_CMD )
1476
1468
1477
1469
# Spawn.
1478
1470
if subprocess .call (command , shell = True ) == 0 :
0 commit comments