text
stringlengths
1
93.6k
# <FILESEP>
# =========================================================================
# Copyright (C) 2022. Huawei Technologies Co., Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# =========================================================================
# import sys
# sys.path.append("/mnt/public/lhh/code/")
import sys
sys.path.append("/home/lhh/code")
from datetime import datetime
import gc
import argparse
from fuxictr import autotuner
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--config', type=str, default='./config/ECN_tuner_config_KKBox.yaml',
help='The config file for para tuning.')
parser.add_argument('--tag', type=str, default=None,
help='Use the tag to determine which expid to run (e.g. 001 for the first expid).')
parser.add_argument('--gpu', nargs='+', default=[0, 1, 2, 3, 2, 1, 0],
help='The list of gpu indexes, -1 for cpu.')
args = vars(parser.parse_args())
gpu_list = args['gpu']
expid_tag = args['tag']
# generate parameter space combinations
config_dir = autotuner.enumerate_params(args['config'])
autotuner.grid_search(config_dir, gpu_list, expid_tag)
# <FILESEP>
#!/bin/python3
import subprocess
import os
import shutil
class color:
def red(self,name):
print(f"\033[91m{name}\033[0m")
def pink(self,name):
print(f"\033[95m{name}\033[0m")
def yellow(self,name):
print(f"\033[93m{name}\033[0m")
def bright(self,name):
print(f"\033[1;32;40m{name}\033[0m")
def blue(self,name):
print(f"\033[1;32;34m{name}\033[0m")
def cyan(self,name):
print(f"\033[1;32;36m{name}\033[0m")
def green(self,name):
print(f"\033[92m{name}\033[0m")
colour=color()
check_root=subprocess.run("id",shell=True,capture_output=True)
if "root" not in str(check_root).lower():
colour.red("Please run as root!!")
os._exit(0)
try:
shutil.rmtree("/opt/PyIntruder")
except:
pass
try:
os.system("pip3 install -r requirements.txt")
colour.green("Creating files")
os.system("mkdir /opt/PyIntruder")
os.system("cp PyIntruder.py ShowJson.py PyI.png /opt/PyIntruder")
os.system("chmod 777 /opt/PyIntruder")
os.system("chmod +x /opt/PyIntruder/PyIntruder.py")
except:
colour.red("File not found!")
os._exit(0)
os.system("touch /usr/share/applications/PyIntruder.desktop")
text="""[Desktop Entry]
Version=1.0
Type=Application
Name=PyIntruder
GenericName=PyIntruder
Comment=Powerful Intruder written in python by Yash and Sagnik H
Categories=Web Application Analysis;Network
Exec=/bin/PyIntruder
Icon=/opt/PyIntruder/PyI.png
Path=/bin
Terminal=false
StartupNotify=false
"""
colour.green("Creating shotcuts")
with open("/usr/share/applications/PyIntruder.desktop","w+") as f: