고졸백수해킹일기

os.system의 결과를 변수로 받아오기 본문

코딩/python

os.system의 결과를 변수로 받아오기

ExploitSori 2020. 10. 8. 15:54

#python2

import commands
ret = commands.getstatusoutput('ls -al /tmp')

print ret

 

##########

#python3

import subprocess
x = subprocess.check_output(['whoami'])

print(x)

'코딩 > python' 카테고리의 다른 글

python thread의 알쓸신잡  (0) 2020.11.17