# DrivePy
DrivePy is a Python package for managing USB drives, flashing ISO files to USB drives, and verifying bootability.
## Installation
You can install DrivePy using pip:
```
pip install drivepy
```
## Usage
### Flash ISO to USB Drive and Make it Bootable
```python
from drivepy.main import DrivePy
iso_path = "path/to/your/iso_file.iso"
usb_drive = "drive_letter_of_your_usb_drive" # Example: "E:" on Windows, "/dev/sdb" on Linux
DrivePy.flash_iso(iso_path, usb_drive)
DrivePy.make_bootable(usb_drive)
```
### Verify Bootability of a USB Drive
```python
from drivepy.main import DrivePy
usb_drive = "drive_letter_of_your_usb_drive" # Example: "E:" on Windows, "/dev/sdb" on Linux
DrivePy.verify_bootability(usb_drive)
```
### List Available USB Drives
```python
from drivepy.main import DrivePy
DrivePy.main()
```
## Example Script
```python
from drivepy.main import DrivePy
def flash_iso_and_boot(iso_path, usb_drive):
# Flash ISO to USB drive
DrivePy.flash_iso(iso_path, usb_drive)
print("ISO flashed to USB drive successfully.")
# Make the USB drive bootable
DrivePy.make_bootable(usb_drive)
print("USB drive made bootable successfully.")
print("Connect the USB drive to your laptop and restart your laptop to boot from it.")
def verify_bootability(usb_drive):
# Check if USB drive is bootable
bootable = DrivePy.is_bootable(usb_drive)
if bootable:
print(f"The USB drive ({usb_drive}) is bootable.")
else:
print(f"The USB drive ({usb_drive}) is not bootable.")
def find_usb_drives():
# Find available USB drives
usb_drives = DrivePy.list_usb_drives()
if not usb_drives:
print("No USB drives detected.")
else:
print("Available USB drives:")
for idx, drive in enumerate(usb_drives, 1):
print(f"{idx}: {drive}")
def main():
print("Welcome to DrivePy!")
while True:
print("\nChoose an option:")
print("1. Flash ISO to USB drive and make it bootable")
print("2. Verify bootability of a USB drive")
print("3. Find available USB drives")
print("4. Exit")
choice = input("Enter your choice (1/2/3/4): ")
if choice == '1':
iso_path = input("Enter the path to the ISO file: ")
usb_drive = input("Enter the drive letter or device path of the USB drive: ")
flash_iso_and_boot(iso_path, usb_drive)
elif choice == '2':
usb_drive = input("Enter the drive letter or device path of the USB drive: ")
verify_bootability(usb_drive)
elif choice == '3':
find_usb_drives()
elif choice == '4':
print("Exiting DrivePy. Goodbye!")
break
else:
print("Invalid choice. Please enter a valid option.")
if __name__ == "__main__":
main()
```
## Additional Notes
- Ensure you have necessary permissions to perform operations like flashing ISO and making bootable.
- The ISO file must be bootable if you intend to make the USB drive bootable.
- For Windows, you may need to run the script with administrator privileges for some operations.
- For macOS, some operations may require sudo privileges.
## Thanks
Thank you for using DrivePy!
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": "https://mrfidal.in/cyber-security/DrivePy",
"name": "drivepy",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Fidal",
"author_email": "mrfidal@proton.me",
"download_url": "https://files.pythonhosted.org/packages/af/21/8a71bfe544fcb162ab2f81285e7a518fc604ce71eaed06ca2c30f15dc578/drivepy-1.0.3.tar.gz",
"platform": null,
"description": "# DrivePy\r\n\r\nDrivePy is a Python package for managing USB drives, flashing ISO files to USB drives, and verifying bootability.\r\n\r\n## Installation\r\n\r\nYou can install DrivePy using pip:\r\n\r\n```\r\npip install drivepy\r\n```\r\n\r\n## Usage\r\n\r\n### Flash ISO to USB Drive and Make it Bootable\r\n\r\n```python\r\nfrom drivepy.main import DrivePy\r\n\r\niso_path = \"path/to/your/iso_file.iso\"\r\nusb_drive = \"drive_letter_of_your_usb_drive\" # Example: \"E:\" on Windows, \"/dev/sdb\" on Linux\r\n\r\nDrivePy.flash_iso(iso_path, usb_drive)\r\nDrivePy.make_bootable(usb_drive)\r\n```\r\n\r\n### Verify Bootability of a USB Drive\r\n\r\n```python\r\nfrom drivepy.main import DrivePy\r\n\r\nusb_drive = \"drive_letter_of_your_usb_drive\" # Example: \"E:\" on Windows, \"/dev/sdb\" on Linux\r\n\r\nDrivePy.verify_bootability(usb_drive)\r\n```\r\n\r\n### List Available USB Drives\r\n\r\n```python\r\nfrom drivepy.main import DrivePy\r\n\r\nDrivePy.main()\r\n```\r\n\r\n## Example Script\r\n\r\n```python\r\nfrom drivepy.main import DrivePy\r\n\r\ndef flash_iso_and_boot(iso_path, usb_drive):\r\n # Flash ISO to USB drive\r\n DrivePy.flash_iso(iso_path, usb_drive)\r\n print(\"ISO flashed to USB drive successfully.\")\r\n\r\n # Make the USB drive bootable\r\n DrivePy.make_bootable(usb_drive)\r\n print(\"USB drive made bootable successfully.\")\r\n\r\n print(\"Connect the USB drive to your laptop and restart your laptop to boot from it.\")\r\n\r\ndef verify_bootability(usb_drive):\r\n # Check if USB drive is bootable\r\n bootable = DrivePy.is_bootable(usb_drive)\r\n if bootable:\r\n print(f\"The USB drive ({usb_drive}) is bootable.\")\r\n else:\r\n print(f\"The USB drive ({usb_drive}) is not bootable.\")\r\n\r\ndef find_usb_drives():\r\n # Find available USB drives\r\n usb_drives = DrivePy.list_usb_drives()\r\n if not usb_drives:\r\n print(\"No USB drives detected.\")\r\n else:\r\n print(\"Available USB drives:\")\r\n for idx, drive in enumerate(usb_drives, 1):\r\n print(f\"{idx}: {drive}\")\r\n\r\ndef main():\r\n print(\"Welcome to DrivePy!\")\r\n while True:\r\n print(\"\\nChoose an option:\")\r\n print(\"1. Flash ISO to USB drive and make it bootable\")\r\n print(\"2. Verify bootability of a USB drive\")\r\n print(\"3. Find available USB drives\")\r\n print(\"4. Exit\")\r\n choice = input(\"Enter your choice (1/2/3/4): \")\r\n\r\n if choice == '1':\r\n iso_path = input(\"Enter the path to the ISO file: \")\r\n usb_drive = input(\"Enter the drive letter or device path of the USB drive: \")\r\n flash_iso_and_boot(iso_path, usb_drive)\r\n elif choice == '2':\r\n usb_drive = input(\"Enter the drive letter or device path of the USB drive: \")\r\n verify_bootability(usb_drive)\r\n elif choice == '3':\r\n find_usb_drives()\r\n elif choice == '4':\r\n print(\"Exiting DrivePy. Goodbye!\")\r\n break\r\n else:\r\n print(\"Invalid choice. Please enter a valid option.\")\r\n\r\nif __name__ == \"__main__\":\r\n main()\r\n```\r\n\r\n## Additional Notes\r\n\r\n- Ensure you have necessary permissions to perform operations like flashing ISO and making bootable.\r\n- The ISO file must be bootable if you intend to make the USB drive bootable.\r\n- For Windows, you may need to run the script with administrator privileges for some operations.\r\n- For macOS, some operations may require sudo privileges.\r\n\r\n## Thanks\r\n\r\nThank you for using DrivePy!\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A tool for managing USB drives and flashing ISOs",
"version": "1.0.3",
"project_urls": {
"Homepage": "https://mrfidal.in/cyber-security/DrivePy"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c0dd70e64393e8321750428530cd600588bd8539a9cb651c18bc5d07b4d9c9c5",
"md5": "815975bdff48606fed6a968de3eb15d6",
"sha256": "e0a80101b49abeb23c4ddeb57cb220d141ca2b8f8a3fa2152442d91c6857626e"
},
"downloads": -1,
"filename": "drivepy-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "815975bdff48606fed6a968de3eb15d6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 4923,
"upload_time": "2024-06-12T19:50:07",
"upload_time_iso_8601": "2024-06-12T19:50:07.500347Z",
"url": "https://files.pythonhosted.org/packages/c0/dd/70e64393e8321750428530cd600588bd8539a9cb651c18bc5d07b4d9c9c5/drivepy-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "af218a71bfe544fcb162ab2f81285e7a518fc604ce71eaed06ca2c30f15dc578",
"md5": "1c28e1d93d0ecb84285ba922a58b8a1f",
"sha256": "4c2c6c6d5d95a7a354c1534844c9d7f22f260ba2673311b2b1765ab20939a6f0"
},
"downloads": -1,
"filename": "drivepy-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "1c28e1d93d0ecb84285ba922a58b8a1f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 4693,
"upload_time": "2024-06-12T19:50:10",
"upload_time_iso_8601": "2024-06-12T19:50:10.052577Z",
"url": "https://files.pythonhosted.org/packages/af/21/8a71bfe544fcb162ab2f81285e7a518fc604ce71eaed06ca2c30f15dc578/drivepy-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-12 19:50:10",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "drivepy"
}