ajones

ip demon - user_interface

Sep 29th, 2012
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. import socket
  3. import os, os.path
  4. import sys
  5. import re
  6. import time
  7.  
  8. #------------------------------------------------------------------------
  9. # Put here path to debug log that is currently written by skypekit runtime
  10. # you need run "skypekit -d logname" before edit this
  11. # also you can parse log by youself like "tail -F /some/folder/logname | grep -a noticing" and use client.py only for send username into socket
  12. PathToLog = "/some/folder/logname"
  13.  
  14.  
  15. if len(sys.argv) == 1:
  16. print('Usage: python skyip.py <skypename>')
  17. sys.exit();
  18.  
  19. Username = sys.argv[1]
  20.  
  21. if os.path.exists( "/tmp/skype_iplookup" ):
  22. client = socket.socket( socket.AF_UNIX, socket.SOCK_DGRAM )
  23. client.connect( "/tmp/skype_iplookup" )
  24. client.send(Username)
  25. client.close()
  26. time.sleep(3)
  27. File = open(PathToLog,'rb').readlines()
  28. finds = []
  29. for matches in File:
  30. finded = re.findall('.*noticing.{0}.0.*-r(.*?)-l(.*?:[0-9]*?)[^0-9].*'.format(Username), matches)
  31. if len(finded)>0:
  32. finds.append('%s - %s'%(finded[0][0],finded[0][1]))
  33. finds = list(set(finds))
  34. for f in finds:
  35. print f
  36. else:
  37. print "Can't connect to unix socket /tmp/skype_iplookup"
Advertisement
Add Comment
Please, Sign In to add comment