Login Register


Personal IP checker. filter_list
Author
Message
Personal IP checker. #1
It's basically an easy way to check your IP address without "whatismyip.com" or whatever that website is.

Import yo' shit, dawg.

We only need four imports. Pretty simple, right?

Code:
import socket import os import sys import time

(PSST, I know I can use commas, I choose not to when importing modules)

Definitions

We will define events "loop" and "close".
This is where the OS module comes into play.

Code:
def loop(event): os.startfile("ipchecker.py"),close(begin) def close(event): os.system('taskkill /PID %d /F' % os.getpid())

IP checker itself

This is pretty simple. All you do is load a few messages and then do an if, elif, else statement.

Code:
msg = print("[IP CHECK]Loading."), time.sleep(2), print("[IP CHECK]Loaded."), time.sleep(1) begin = print("[IP CHECK] %s " % socket.gethostbyname(socket.gethostname())), time.sleep(1) answer = input("[IP CHECK]Reload? ") if answer == "yes": loop(begin), os.system("clear") elif answer == "no": try: print("[IP CHECK]Process killed.") close(begin) except Exception as e: print(e) else: print("[IP CHECK]Invalid command."), time.sleep(2), loop(begin)

EVERYBODY NOW!

This is the code all together.

Code:
import socket import os import sys import time def loop(event): os.startfile("ipchecker.py"),close(begin) def close(event): os.system('taskkill /PID %d /F' % os.getpid()) msg = print("[IP CHECK]Loading."), time.sleep(2), print("[IP CHECK]Loaded."), time.sleep(1) begin = print("[IP CHECK] %s " % socket.gethostbyname(socket.gethostname())), time.sleep(1) answer = input("[IP CHECK]Reload? ") if answer == "yes": loop(begin), os.system("clear") elif answer == "no": try: print("[IP CHECK]Process killed.") close(begin) except Exception as e: print(e) else: print("[IP CHECK]Invalid command."), time.sleep(2), loop(begin)

Hope you like what took my five minutes to code.

Somewhere down the road, I will be adding an IP hider.
(This post was last modified: 01-24-2014, 04:01 AM by Equinox.)
[Image: BXqGARG.png]

Reply

RE: Personal IP checker. #2
love in the beginning you were kind of getto haha

Reply

RE: Personal IP checker. #3
The following code is completely unnecessary
Code:
msg = print("[IP CHECK]Loading."), time.sleep(2), print("[IP CHECK]Loaded."), time.sleep(1)
[Image: jWSyE88.png]

Reply

RE: Personal IP checker. #4
(01-24-2014, 10:28 PM)3SidedSquare Wrote: The following code is completely unnecessary
Code:
msg = print("[IP CHECK]Loading."), time.sleep(2), print("[IP CHECK]Loaded."), time.sleep(1)
that's there for effect.
[Image: BXqGARG.png]

Reply







Users browsing this thread: