-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathupdate.py
More file actions
48 lines (39 loc) · 1.36 KB
/
update.py
File metadata and controls
48 lines (39 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Author: @Gtajisan
GitHub: https://github.com/Gtajisan/FARHAN-Shot
License: MIT License
Disclaimer:
This tool is for educational and authorized penetration testing only.
Do NOT use on unauthorized networks.
The author is not responsible for any misuse.
"""
import os
import sys
import subprocess
import colors
def print_info(msg):
print(f"{colors.green}[+]{colors.reset} {msg}")
def print_warn(msg):
print(f"{colors.yellow}[!]{colors.reset} {msg}")
def print_error(msg):
print(f"{colors.red}[-]{colors.reset} {msg}")
def is_termux():
return os.getenv("PREFIX", "").startswith("/data/data/com.termux/files/usr")
def main():
if not is_termux():
print_warn("You don't appear to be running inside Termux. Proceeding anyway.")
if not os.path.isdir('.git'):
print_error("This directory is not a Git repository (missing .git folder).")
sys.exit(1)
print_info("Pulling latest changes from Git repository...")
try:
result = subprocess.run(['git', 'pull'], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
print(result.stdout)
print_info("Update completed successfully.")
except subprocess.CalledProcessError as e:
print_error(f"Git pull failed:\n{e.stderr}")
sys.exit(1)
if __name__ == '__main__':
main()