Skip to content

Commit b23ed0d

Browse files
authored
Merge pull request #29 from kontr0x/kontr0x-patch-1
Added check for effective uid
2 parents 5d732ec + c97b2a5 commit b23ed0d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

main.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,13 +345,14 @@ def switchTether(self):
345345
def getSUDO():
346346
output = ""
347347
password = ""
348-
while output[:-1] != "0000":
349-
password = getpass.getpass("Enter sudo password : ")
350-
p = subprocess.Popen("sudo -S echo '0000'", stdin=subprocess.PIPE,
348+
if os.geteuid() != 0:
349+
while output[:-1] != "0000":
350+
password = getpass.getpass("Enter sudo password : ")
351+
p = subprocess.Popen("sudo -S echo '0000'", stdin=subprocess.PIPE,
351352
stderr=subprocess.PIPE, stdout=subprocess.PIPE, text=True, shell=True)
352-
prompt = p.communicate(password + '\n')
353-
output = prompt[0]
354-
DebugPrint(output[:-1])
353+
prompt = p.communicate(password + '\n')
354+
output = prompt[0]
355+
DebugPrint(output[:-1])
355356

356357

357358
class iDevice:

0 commit comments

Comments
 (0)