Advertisement
e55db081d05f58a

randomIP.py

Apr 29th, 2021
2,198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. #! /usr/bin/python
  2. import os,sys,random;
  3. def main():
  4.         b = os.urandom(32);
  5.         rs = random.SystemRandom();
  6.         r_i = rs.randint(0, sys.maxint);
  7.         a = str(r_i >> 24 & 0xFF);
  8.         b =  str(r_i >> 16 & 0xFF);
  9.         c =  str(r_i >> 8 & 0xFF);
  10.         d =  str(r_i & 0xFF);
  11.         octe = r_i%3;
  12.         if(octe==0):
  13.             a='x'
  14.         if(octe==1):
  15.             b='x'
  16.         if(octe==2):
  17.             c='x'
  18.         if(octe==3):
  19.             d='x';
  20.         print(a+"."+b+"."+c+"."+d);
  21.          
  22. if __name__=="__main__":
  23.         main();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement