This repository contains a collection of Python programs for various purposes.
The ipInfo.py
script uses the ipinfo
library to retrieve the location details of a given IP address. It fetches the IP address from the api.ipify.org
service and then uses the ipinfo
API to get the corresponding location information, such as city, region, country, latitude, longitude, and timezone. The location details are saved in a JSON file located in the Output
folder.
This folder contains two Python scripts, lock.py
and unlock.py
, that provide functionality to lock and unlock files and folders, respectively.
The lock.py
script recursively traverses a specified directory and performs the following actions:
- Removes all permissions for directories.
- Renames directories with a leading dot (
.
) to hide them. - Removes all permissions for files.
- Renames files with a leading dot (
.
) to hide them.
The script assumes the presence of a Lock_Unlock
folder containing a Lock
folder in the current working directory.
The unlock.py
script is designed to reverse the actions performed by the lock.py
script. It recursively traverses the hidden Lock
folder and performs the following actions:
- Restores original permissions for directories (set to 0o755 by default, but you can adjust it according to your needs).
- Removes the leading dot (
.
) from directory names to unhide them. - Restores original permissions for files (set to 0o644 by default, but you can adjust it according to your needs).
- Removes the leading dot (
.
) from file names to unhide them.
After unhiding all files and folders, the script renames the Lock
folder back to its original name.
The pingloop.py
script continuously pings a specified website using the ping
command from the operating system. It demonstrates how to execute system commands from within a Python script.
The WebsitePing
class encapsulates the functionality of pinging a website. It takes a URL as input and provides methods to ping the website and run the pinger in a loop.
When executed, the script prompts the user to enter the URL to ping, creates an instance of the WebsitePing
class, and starts the pinger loop. The loop continuously pings the specified website and prints a message indicating whether the website is reachable or not.
The Simple_Map
folder contains a script that generates a simple interactive map using the folium
library. This script demonstrates how to create and customize maps in Python.
The script takes a set of geographical coordinates as input and plots them on the map. It also allows for adding markers and popups to specific locations, providing a visual representation of the data.
To use the script, you need to have the folium
library installed, which can be done using pip
:
pip install folium
pip install geocoder
The project is organized as follows:
C:.
├───IpINFO
├───Lock_Unlock
├───Output
├───PingWebsite
└───Simple_Map
└───Locations
-
Clone the repository:
git clone https://github.com/prabinpanta0/Python-Time-Pass.git
-
Navigate to the desired project folder.
-
Follow the specific instructions for each project as mentioned in the respective sections above.
For example, to run the pingloop.py script:
cd PingWebsite
python pingloop.py
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.