Be myself :: Demon using nc.traditional

달력

22025  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import os
import sys
def main():
    if len(sys.argv) != 3:
        print "[usage]python daemon.py filepath port"
        sys.exit()
    while True:
        pid = os.fork()
        if pid == 0:
            os.execlp('nc.traditional','nc.traditional','-v','-e',sys.argv[1],'-l','-p',sys.argv[2])
        else:
            print "child pid %d" %(pid)
            os.waitpid(pid,0)
         
if __name__ == "__main__":
    main()

'Python' 카테고리의 다른 글

String과 Integer 변환 정리  (0) 2015.08.25
os.execve 주의  (0) 2015.03.31
str과 repr의 차이  (0) 2015.02.22
with~as 구문  (0) 2015.02.22
개발 시 팁  (0) 2015.02.18
Posted by flack3r
|