def command_line(): """ Process command line options. """ opts, args = getopt.getopt(sys.argv[1:], 'smgtpO') mode = None optimize = None for o in opts: o = o[0][1:] if o in 'sm': mode = o elif o in 'gtpO': optimize = o if not args: build(mode, optimize) else: if args[0] == 'docs': docs() elif args[0] == 'path': util.install_path() elif args[0] == 'unpath': util.uninstall_path() elif args[0] == 'install': util.install() elif args[0] == 'uninstall': util.uninstall() elif args[0] == 'rspec': rspec() else: sys.exit('Error: unknown option: %r' % sys.argv[1])
def install_pc(sn): pc_apk = os.path.join(os.path.dirname(__file__), 'lib', 'packetcapture.apk') pc_package, pc_activity = parse_apk(pc_apk) if not has_install(sn, pc_package): install(sn, pc_apk) return pc_package, pc_activity
def run(): print("Initializing settings") initSettings.run() settings = getSettings() print("Making output file") if not os.path.exists(settings["videoOut"]): os.mkdir(settings["videoOut"]) install("pyopenssl")
def install_app(sn, apk): package, activity = parse_apk(apk) if not has_install(sn, package): install(sn, apk) else: uninstall(sn, package) install(sn, apk) return package, activity
# https://gist.github.com/pinxau1000/8817d4ef0ed766c78bac8e6feafc8b47 # https://github.com/pinxau1000/ except ModuleNotFoundError: from urllib import request print("'util.py' not found on the same folder as this script!") _url_utilpy = "https://gist.githubusercontent.com/pinxau1000/8817d4ef0ed766c78bac8e6feafc8b47/raw/util.py" print("Downloading util.py from:\n" + _url_utilpy) # https://stackoverflow.com/questions/7243750/download-file-from-web-in-python-3 request.urlretrieve(_url_utilpy, "util.py") print("Downloading finished!") import util try: import cv2 as cv except ModuleNotFoundError: util.install("opencv-python") import cv2 as cv try: from matplotlib import pyplot as plt except ModuleNotFoundError: util.install("matplotlib") from matplotlib import pyplot as plt try: import numpy as np except ModuleNotFoundError: util.install("numpy>=1.19,<1.19.4") import numpy as np try:
import threading import datetime import json import time import os import numpy as np import init init.run() import notifacation import util try: from flask import Flask, render_template, render_template_string, Response, redirect, url_for, request except: util.install("flask") from flask import Flask, render_template, render_template_string, Response, redirect, url_for, request try: from dateutil import tz except: util.install("python-dateutil") from dateutil import tz try: import psutil except: util.install("psutil") import psutil try: import cv2