IP Uploader – Python Script (.py)

This is my first python script I ever wrote. This script connects to whatismyip.com, fetches the external IP address of the network you are on, puts it into a text file and uploads it via FTP to any server you want.

At home I have Cox, therefore I have a dynamic IP. Even though this IP only changes about once every month, I got sick of needing to connect to my home computer via VNC and not being able because my IP had changed. Therefore I created the following script and set up a scheduled task on my home computer to run this script every hour.

After running this script, you can then use PHP (or any similar language) to include this file into any page you desire.

 #! /usr/bin/env python
import httplib
import sys
import os
import ftplib
 
file="ip.txt"
 
conn = httplib.HTTPConnection("www.whatismyip.com")
conn.request("GET","/automation/n09230945.asp")
response = conn.getresponse()
data = response.read()
 
filename = str(os.path.abspath(os.path.dirname(sys.argv[0])) + "\\"+file) #Create file
FILE = open(filename,"w") #Open file ready for writing
FILE.writelines(data) #Write 'data' to file
FILE.close() #Close file
 
#Replace [server], [user], and [pass] with your information.
s = ftplib.FTP('[server]','[user]','[pass]') #Connect
f = open(file,'rb') #File to send
s.storbinary('STOR '+file, f) #Send the file
f.close() #Close file and FTP
s.quit() #Quit FTP
 
sys.exit(0)

Shouts to Automated Penguin and Nak!

Metacab

Metacab is a cabinet file that contains Netcat, Nmap, VNC and other remote administration utilities that need only a Windows command shell, cmd.exe, to install and use. Install and uninstall scripts are included, and work is being completed on antivirus evasion.

Credits:
dre – For suggestions
dual – For originally putting it together
Evil1 – For suggestions
Nak – For making Netcat invisible to anitvirus (only DCOM and PnP to go!)
PHLAK – For testing
Zapper – For testing and suggestions
…and of course XlogicX for hosting the project page and Packet Storm for hosting the stable versions.

Conversation about the project can be found at: Forums – General Discussion – Metacab

Stable Version:
metacab-2006-05-R7.zip
stable.sha256.txt

Older Versions:
metacab-2006-04-R6.zip
metacab-2006-04-R5.zip
metacab-2006-04-R4.zip
metacab-2006-04-R3.zip
metacab-2006-03-R2.tar.gz
metacab-2006-03-R1.tar.gz

October 2003 Meeting History

RAX gave a presentation on running SSH over a VNC tunnel. Zapperlink contacted Emmanuel Goldstein on IRC about getting our Barnes and Noble location “official” instead of the Arizona Mills location. Discussions included talk of Napster and the LiteStep GUI for windows.

Attendance count: N/A

Next Offical Meeting Date: October 1, 2010 Time: 6:00 pm Click for more info