Greetings My Fellow Aspiring Hackers,
Its been long since I last posted a tutorial. Its vacation and since I won't be coming home, I've decided to use my day for sharing. I was browsing through old posts and found OTW's article - Hack Like A Pro: How to Find the Exact Location of Any IP Address. Honestly, It was a cool one, EnergyWolf gracefully did us the honor of building an android application.
Now, for the desktop GUI, No one wants to do the honor, which is absolutely not fair. Don't worry, I've the whole day in the ICT Lab. No IT Administrators to order me around, Infact, Today seems to be the perfect day. Don't you think ?. Yeah, I know you are pissed off so lemme get to the point. Thanks for reading.
INTRODUCTION TO PYTHON GUI - PYQT
PyQt is a Python binding of the cross-platform GUI toolkit Qt. It is one of Python's options for GUI programming. Popular alternatives are PySide (the Qt binding with official support and a more liberal licence), PyGTK, wxPython, and Tkinter (which is bundled with Python). Like Qt, PyQt is free software. PyQt is implemented as a Python plug-in.
Its python friend in GUI building, Its simple, fun, frustrating and also annoying so unless you promise yourself not to smash your screen when you get an error, close the page and sleep. Am also new to PyQt so I understand the frustrating when an error occurs. Lets see some requirements.
REQUIREMENTS
Umm, Windows users are highly exempted, Maybe for now. Sorry, am in a limited environment and I have only linux running so i guess google can be your best friend now for this tutorial if you are using windows. Thanks for bearing with me. You are soo kind. For linux:
- PyQT ( Installed By Default )
- Qt Designer
- Pyuic4
- apt-get install pyqt4-dev-tools qt4-designer
Step 01: User Interface ( UI ) Of Qt Designer
The Qt designer only helps with the GUI Building in our case and doesn't do the coding so we will have to convert the gui file .ui to a python file .py after building the GUI. Lets begin by opening Qt Designer.
Step 02: Designing The User Interface
Ok, for this part. We carefully design the interface because a mistake could lead to code displacement. Thank-you.
- Frame 1
- 1 label with the description: IP Address:
- 1 PushButton ( A button is called a PushButton in Qt )
- 1 lineEdit ( A textbox is called a lineEdit in Qt )
- Frame 2
- 1 label with the description: Tip: Enter An IP Address In The TextBox And Click Search
- Frame 3
- 1 listWidget ( A listbox is called a listWidget in Qt )
A CLOSE VIEW AT THE FINISHED WINDOW
Before we move on to the code, We need to make some changes to the objectNames of the items dragged onto the form. Do the following:
- Click ( Not double Click, Just A Click ) the ip address label you created, Look at the right side of the Qt designer, you will see a property box with the properties of the object selected which in this case is the ip address label. Look for objectName and change the value from label to ip_label
- Click the textbox, change the objectName to ip_textbox
- Click the button search and change the objectName to search_btn
- Click the Tip: Enter An IP ... label and change the objectName to info_bar
- Click the listWidget ( listbox ) and change the objectName to search_list
- Finally, Click on the main form or main window and change the objectName to PyGeoIP_Window
Now we have our
- Sploit #> pyuic4 --help
- Sploit #> pyuic4 -x
.ui -o .py
Now lets open our newly created file in our text editors. I am using sublime and its really cool. If you want it, Download it from google, I am waiting for you.
There it is, line 34 to line 36. self.search_btn.set = QtGui.Qt ... We then place a code between line 36 and 37. We put this line between them.
- self.search_btn.clicked.connect(self.search)
When a self. is appended to something, It simply means that object or function can be found in the same class as the self, When there is no self, the function or object can be found outside the class.
Now lets write the search() function under def retranslateUi(self, PyGeoIP_Window):. It can be located on line 69, After the retranslateUI function(), write this code:
Step 05: Last Two Functions
Step 06: Bringing It All Together
Save it. Lets now move our python file into the PyGeoIP Folder that was created in OTW's tutorial where we executed python geoip file in step 4.
My path is: /Desktop/Experiment/IP_Location/pygeoip-0.1.3. Now, open a shell in the same directory and execute: python
- The User Interface
- Lets Enter Some Input: 63.12.14.90
- Executing Using Console
Step 08: Conclusion
Hope someday had fun. Thanks for reading and its late. I've got to sleep now. Bye bye. See you in the morning.
No comments:
Post a Comment