faqts : Computers : Programming : Languages : Python : Snippets

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 2 people (50%) answered Yes
Recently 0 of 1 people (0%) answered Yes

Entry

Obfuscated single-line scripts

Aug 9th, 2008 02:24
Sek Tea, Nathan Wallace, Hans Nowak, Snippet 14, William Breen


"""
Packages: miscellaneous.obfuscated
"""
"""
> I've found the following essentially single-line Python script useful in
> decoding hexadecimal IP-Numbers (as given by /sbin/hostid on most unix
> systems, I believe).
> (For python newbies: The two lines at the bottom of the script should be
> combined to one line)
here is one I came up w/ (probably not the best.. but good enough).
"""
#!/usr/local/bin/python
from sys import *;from string import *
print dir()
if(len(argv)<2): 
	print "Usage: quadrupel fa04a404"
	exit()
print join(map(lambda x,y=argv[1]:'%d' %
atoi(y[2*x:2*x+2],16),(0,1,2,3)),'.')
http://regalos-de-navidad.blogspot.com/
http://regalosdesanvalentin.blogspot.com/
http://ideas-para-regalar.blogspot.com/