code stringlengths 1 1.05M | repo_name stringlengths 6 83 | path stringlengths 3 242 | language stringclasses 222
values | license stringclasses 20
values | size int64 1 1.05M |
|---|---|---|---|---|---|
#!/bin/bash
# SD WebUI Forge 启动参数配置
# 启动参数将保存在 <Start Path>/term-sd/config/sd-webui-forge-launch.conf
sd_webui_forge_launch_args_setting() {
local arg
local dialog_arg
local launch_args
local i
dialog_arg=$(dialog --erase-on-exit --notags \
--title "Stable-Diffusion-WebUI 管理" \
--b... | 2301_81996401/term-sd | modules/sd_webui_forge_launch.sh | Shell | agpl-3.0 | 21,177 |
#!/bin/bash
# SD WebUI 管理
sd_webui_manager() {
local dialog_arg
local sd_webui_branch
local sd_webui_branch_point
cd "${START_PATH}" # 回到最初路径
exit_venv # 确保进行下一步操作前已退出其他虚拟环境
if [[ -d "${SD_WEBUI_ROOT_PATH}" ]] && ! term_sd_is_dir_empty "${SD_WEBUI_ROOT_PATH}" ;then # 找到stable-diffusion-webui目... | 2301_81996401/term-sd | modules/sd_webui_manager.sh | Shell | agpl-3.0 | 21,922 |
#!/bin/bash
# SD WebUI reForge 启动参数配置
# 启动参数将保存在 <Start Path>/term-sd/config/sd-webui-reforge-launch.conf
sd_webui_reforge_launch_args_setting() {
local arg
local dialog_arg
local launch_args
local i
dialog_arg=$(dialog --erase-on-exit --notags \
--title "Stable-Diffusion-WebUI 管理" \
... | 2301_81996401/term-sd | modules/sd_webui_reforge_launch.sh | Shell | agpl-3.0 | 21,241 |
#!/bin/bash
# 获取 CUDA 内存分配器配置
get_pytorch_cuda_memory_conf() {
local status
status=$(term_sd_python "${START_PATH}/term-sd/python_modules/check_cuda_malloc_avaliable.py")
echo "${status}"
}
# CUDA 内存分配设置
# 参考:
# https://blog.csdn.net/MirageTanker/article/details/127998036
# https://github.com/AUTOMATIC1... | 2301_81996401/term-sd | modules/term_sd_check_cuda_malloc_avaliable.sh | Shell | agpl-3.0 | 2,277 |
#!/bin/bash
# 自定义 AI 软件安装路径设置
# SD WebUI 自定义安装路径配置保存在 <Start Path>/term-sd/config/sd-webui-path.conf
# ComfyUI 自定义安装路径配置保存在 <Start Path>/term-sd/config/comfyui-path.conf
# InvokeAI 自定义安装路径配置保存在 <Start Path>/term-sd/config/invokeai-path.conf
# Fooocus 自定义安装路径配置保存在 <Start Path>/term-sd/config/fooocus-path.conf
# lora-sc... | 2301_81996401/term-sd | modules/term_sd_custom_install_path_setting.sh | Shell | agpl-3.0 | 32,485 |
#!/bin/bash
# 检查 ComfyUI 环境完整性
# 如果出现缺失依赖, 将依赖文件路径保存在 <Term-SD>/term-sd/task/comfyui_depend_path_list.sh
# 如何出现冲突依赖, 将分析出来的冲突情况保存在 <Term-SD>/term-sd/task/comfyui_has_conflict_requirement_notice.sh
check_comfyui_env() {
term_sd_echo "检测 ComfyUI 依赖完整性中"
rm -f "${START_PATH}/term-sd/task/comfyui_has_conflict_requ... | 2301_81996401/term-sd | modules/term_sd_env_check.sh | Shell | agpl-3.0 | 19,499 |
#!/bin/bash
# 获取当前目录下的所有文件夹
# 使用:
# get_dir_folder_list <路径>
# 执行完成后返回一个全局变量(数组) LOCAL_DIR_LIST
# 使用 ${LOCAL_DIR_LIST[@]} 进行调用
# 在 Bash 版本低于 4 时需要使用 ${LOCAL_DIR_LIST} 进行调用
get_dir_folder_list() {
local i
local path
local file_name
local list
unset LOCAL_DIR_LIST
if [[ -z "$@" ]]; then
... | 2301_81996401/term-sd | modules/term_sd_get_dir_list.sh | Shell | agpl-3.0 | 2,582 |
#!/bin/bash
# Git 版本切换
# 使用:
# git_ver_switch <仓库路径>
git_ver_switch() {
local dialog_arg
local origin_branch
local ref
local path
local name
local current_commit_hash
if [[ -z "$@" ]]; then
path=$(pwd)
else
path=$@
fi
if is_git_repo "${path}"; then # 检测目录中是否有.g... | 2301_81996401/term-sd | modules/term_sd_git.sh | Shell | agpl-3.0 | 16,948 |
#!/bin/bash
# 远程源的种类检测
# 如果是 Github 链接则返回 0, 不是则返回 1
git_remote_url_type_is_github() {
local GIT_CONFIG_GLOBAL= # 临时取消 Git 配置, 防止影响远程源的判断
if [[ ! -z "$(git remote get-url origin | grep github.com)" ]]; then # 检测远程源的原地址是否属于 Github 地址
return 0
else
return 1
fi
}
# 修改远程源(先判断远程源是否符合修改要求)
... | 2301_81996401/term-sd | modules/term_sd_git_repo_change.sh | Shell | agpl-3.0 | 17,370 |
#!/bin/bash
# Git 全局镜像源设置
# Git 镜像源配置保存在 <Start Path>/term-sd/config/set-global-github-mirror.conf
# Git 配置保存在 <Start Path>/term-sd/config/.gitconfig
# 动态 Git 镜像源配置保存在 <Start Path>/term-sd/config/set-dynamic-global-github-mirror.lock
# 设置 GIT_CONFIG_GLOBAL 环境变量指定 Git 使用的配置文件
# 使用 TERM_SD_GITHUB_MIRROR 全局变量获取镜像源地址
term... | 2301_81996401/term-sd | modules/term_sd_github_mirror.sh | Shell | agpl-3.0 | 9,958 |
#!/bin/bash
# HuggingFace 全局镜像源设定
# 使用 HF_ENDPOINT 环境变量设置 HuggingFace Api 使用的镜像源
# 使用 TERM_SD_HUGGINGFACE_MIRROR 全局变量获取使用的 HuggingFace 镜像源
term_sd_huggingface_global_mirror_setting() {
local dialog_arg
local huggingface_mirror_status
local dynamic_huggingface_mirror_status
while true; do
if [[... | 2301_81996401/term-sd | modules/term_sd_huggingface_mirror.sh | Shell | agpl-3.0 | 6,661 |
#!/bin/bash
# 启动 AI 软件
# 使用 TERM_SD_MANAGE_OBJECT 全局变量判断要启动的 AI 软件
# 根据对应的 AI 软件读取对应的启动配置文件
# 使用的配置文件:
# A1111 SD WebUI: <Start Path>/term-sd/config/sd-webui-launch.conf
# Vlad SD WebUI: <Start Path>/term-sd/config/vlad-sd-webui-launch.conf
# SD WebUI DirectML: <Start Path>/term-sd/config/sd-webui-directml-launch.conf... | 2301_81996401/term-sd | modules/term_sd_manager.sh | Shell | agpl-3.0 | 28,338 |
#!/bin/bash
# 在安装过程中, 只有 HuggingFace / Github 的访问有问题
#若全程保持代理, 可能会导致安装速度下降, 因为 Python 软件包的下载没必要走代理, 走代理后代理的速度可能比镜像源的速度慢
# 临时取消代理配置
term_sd_tmp_disable_proxy() {
if [[ ! -z "${HTTP_PROXY}" ]] && is_use_only_proxy; then
term_sd_echo "HuggingFace / Github 下载源独占代理已启用, 临时取消代理配置"
unset HTTP_PROXY # 将代理配置... | 2301_81996401/term-sd | modules/term_sd_proxy.sh | Shell | agpl-3.0 | 17,476 |
#!/bin/bash
# 处理 Python 命令
# 使用 TERM_SD_PYTHON_PATH 全局变量读取 Python 的路径
term_sd_python() {
# 检测是否在虚拟环境中
if [[ ! -z "${VIRTUAL_ENV}" ]]; then # 当处在虚拟环境时
# 检测使用哪种命令调用python
# 调用虚拟环境的python
if [[ ! -z "$(python --version 2> /dev/null)" ]]; then
python "$@" # 加双引号防止运行报错
el... | 2301_81996401/term-sd | modules/term_sd_python_cmd.sh | Shell | agpl-3.0 | 1,171 |
#!/bin/bash
# 虚拟环境设置
# 使用 ENABLE_VENV 全局变量保存虚拟环境的启用状态
python_venv_setting() {
local dialog_arg
while true; do
dialog_arg=$(dialog --erase-on-exit --notags \
--title "Term-SD" \
--backtitle "虚拟环境设置界面" \
--ok-label "确认" --cancel-label "取消" \
--menu "该功能用于给... | 2301_81996401/term-sd | modules/term_sd_python_config.sh | Shell | agpl-3.0 | 10,396 |
#!/bin/bash
# Term-SD 设置
term_sd_setting() {
local dialog_arg
local pip_mirror_setup_info
local venv_setup_info
local python_package_manager_info
local proxy_setup_info
local github_mirror_setup_info
local term_sd_cmd_retry_setup_info
local term_sd_enable_strict_install_mode_setup_info
... | 2301_81996401/term-sd | modules/term_sd_setting.sh | Shell | agpl-3.0 | 24,918 |
#!/bin/bash
# 安装任务管理
# 命令后面需加上 AI 软件名称
# 使用 TERM_SD_MANAGE_OBJECT 全局变量设置正在管理的 AI 软件名称
# 调用时将检测 <Start Path>/term-sd/task/ 中是否存在未完成的安装任务
# 如果存在, 则提示是否继续进行安装
# 如果不存在, 则进入管理界面
# 使用:
# term_sd_install_task_manager <AI 软件的名称>
# 可用名称: stable-diffusion-webui, ComfyUI, InvokeAI, Fooocus, lora-scripts, kohya_ss
# 对应的安装任务配置: sd... | 2301_81996401/term-sd | modules/term_sd_task_manager.sh | Shell | agpl-3.0 | 7,440 |
#!/bin/bash
# 命令自动重试功能
# 使用 TERM_SD_CMD_RETRY 全局变量获取重试次数
term_sd_try() {
local count=0
if (( TERM_SD_CMD_RETRY == 0 )); then
"$@" # 执行输入的命令
else
while (( count <= TERM_SD_CMD_RETRY ));do
count=$(( count + 1 ))
"$@" # 执行输入的命令
if [[ "$?" == 0 ]]; then
... | 2301_81996401/term-sd | modules/term_sd_try.sh | Shell | agpl-3.0 | 4,681 |
#!/bin/bash
# Term-SD 更新功能
term_sd_update_manager() {
local dialog_arg
local req
local commit_hash
local local_commit_hash
local origin_branch
local ref
local auto_update_info
if is_git_repo "${START_PATH}/term-sd"; then
while true; do
if [[ -f "${START_PATH}/te... | 2301_81996401/term-sd | modules/term_sd_update.sh | Shell | agpl-3.0 | 11,739 |
#!/bin/bash
# 处理 uv 命令
term_sd_uv() {
if [[ ! -z "${VIRTUAL_ENV}" ]]; then
uv "$@"
else
UV_PYTHON=$TERM_SD_PYTHON_PATH uv "$@"
fi
}
# 处理 uv 安装命令
term_sd_uv_install() {
check_uv_upgrade
term_sd_uv pip install "$@"
}
# 安装 uv
term_sd_init_uv() {
term_sd_pip install uv --upgrade
}... | 2301_81996401/term-sd | modules/term_sd_uv.sh | Shell | agpl-3.0 | 3,315 |
#!/bin/bash
# 一键更新全部插件功能
# 该功能在 SD WebUI, ComfyUI 中共用的
# 使用 TERM_SD_MANAGE_OBJECT 全局变量显示要更新插件的 AI 软件
update_all_extension() {
local extension_update_req
local sum=0
local count=0
local success_count=0
local fail_count=0
local i
local is_invokeai_node_disable=0
term_sd_print_line "${TER... | 2301_81996401/term-sd | modules/update_all_extension.sh | Shell | agpl-3.0 | 2,376 |
#!/bin/bash
# Vlad SD WebUI 启动参数配置
# 启动参数保存在 <Start Path>/term-sd/config/vlad-sd-webui-launch.conf
vlad_sd_webui_launch_args_setting() {
local dialog_arg
local arg
local launch_args
local i
# 展示启动参数选项
dialog_arg=$(dialog --erase-on-exit --notags \
--title "Stable-Diffusion-WebUI 管理" \
... | 2301_81996401/term-sd | modules/vlad_sd_webui_launch.sh | Shell | agpl-3.0 | 10,404 |
"""ComfyUI 运行环境检查"""
import re
import os
import sys
import copy
import logging
import argparse
import importlib.metadata
from collections import namedtuple
from pathlib import Path
from typing import Optional, TypedDict, Union
def get_args() -> argparse.Namespace:
"""获取命令行参数输入参数输入"""
parser = argparse.Argume... | 2301_81996401/term-sd | python_modules/check_comfyui_env.py | Python | agpl-3.0 | 52,426 |
try:
import controlnet_aux # noqa: F401
success = True
except:
success = False
if not success:
from importlib.metadata import requires
try:
invokeai_requires = requires("invokeai")
except:
invokeai_requires = []
controlnet_aux_ver = None
for req in invokeai_requires... | 2301_81996401/term-sd | python_modules/check_controlnet_aux.py | Python | agpl-3.0 | 593 |
import os
import importlib.util
import subprocess
# Can't use pytorch to get the GPU names because the cuda malloc has to be set before the first import.
def get_gpu_names():
if os.name == "nt":
import ctypes
# Define necessary C structures and types
class DISPLAY_DEVICEA(ctypes.Structure... | 2301_81996401/term-sd | python_modules/check_cuda_malloc_avaliable.py | Python | agpl-3.0 | 4,067 |
from importlib.metadata import version
try:
tmp = version("invokeai")
print(True)
except:
print(False)
| 2301_81996401/term-sd | python_modules/check_invokeai_installed.py | Python | agpl-3.0 | 116 |
import re
import argparse
import importlib.metadata
from pathlib import Path
from enum import Enum
def get_args() -> argparse.Namespace:
"""获取命令行参数
:return `argparse.Namespace`: 命令行参数命名空间
"""
parser = argparse.ArgumentParser()
parser.add_argument(
"--ignore-ort-install",
action="... | 2301_81996401/term-sd | python_modules/check_onnxruntime_gpu.py | Python | agpl-3.0 | 7,368 |
import re
import argparse
from importlib.metadata import version
def get_args() -> argparse.Namespace:
"""获取命令行参数
:return `argparse.Namespace`: 命令行参数命名空间
"""
parser = argparse.ArgumentParser()
parser.add_argument(
"--pip-mininum-ver", type=str, default="25.0", help="Pip 最低版本"
)
... | 2301_81996401/term-sd | python_modules/check_pip_need_upgrade.py | Python | agpl-3.0 | 1,949 |
import os
import pathlib
import json
import argparse
from pathlib import Path
# 参数输入
def get_args():
parser = argparse.ArgumentParser()
normalized_filepath = lambda filepath: str(Path(filepath).absolute().as_posix())
parser.add_argument(
"--config-path",
type=normalized_filepath,
... | 2301_81996401/term-sd | python_modules/check_sd_webui_extension_disabled.py | Python | agpl-3.0 | 1,377 |
import re
import argparse
from importlib.metadata import version
def get_args() -> argparse.Namespace:
"""获取命令行参数
:return `argparse.Namespace`: 命令行参数命名空间
"""
parser = argparse.ArgumentParser()
parser.add_argument("--uv-mininum-ver", type=str, default="0.1", help="uv 最低版本")
return parser.par... | 2301_81996401/term-sd | python_modules/check_uv_version.py | Python | agpl-3.0 | 1,921 |
import os
import re
import argparse
from pathlib import Path
def get_args():
parser = argparse.ArgumentParser()
normalized_filepath = lambda filepath: str(Path(filepath).absolute().as_posix())
parser.add_argument(
"--venv-bin-path",
type=normalized_filepath,
default=None,
... | 2301_81996401/term-sd | python_modules/check_venv_path_invalid.py | Python | agpl-3.0 | 2,746 |
import importlib.util
import shutil
import os
import ctypes
import logging
try:
torch_spec = importlib.util.find_spec("torch")
for folder in torch_spec.submodule_search_locations:
lib_folder = os.path.join(folder, "lib")
test_file = os.path.join(lib_folder, "fbgemm.dll")
dest = os.path.... | 2301_81996401/term-sd | python_modules/fix_torch.py | Python | agpl-3.0 | 871 |
from importlib.metadata import requires
def get_package_name(package: str) -> str:
"""从 Python 包版本声明中获取包名
:param package`(str)`: Python 包版本声明
:return `str`: Python 包名
"""
return (
package.split("~=")[0]
.split("===")[0]
.split("!=")[0]
.split("<=")[0]
.spli... | 2301_81996401/term-sd | python_modules/get_invokeai_require_pytorch.py | Python | agpl-3.0 | 1,523 |
from importlib.metadata import requires
def get_package_name(package: str) -> str:
"""从 Python 包版本声明中获取包名
:param package`(str)`: Python 包版本声明
:return `str`: Python 包名
"""
return (
package.split("~=")[0]
.split("===")[0]
.split("!=")[0]
.split("<=")[0]
.spli... | 2301_81996401/term-sd | python_modules/get_invokeai_require_xformers.py | Python | agpl-3.0 | 1,187 |
from importlib.metadata import version
try:
ver = version("invokeai")
except:
ver = None
print(ver)
| 2301_81996401/term-sd | python_modules/get_invokeai_version.py | Python | agpl-3.0 | 110 |
import importlib.metadata
from importlib.metadata import version
try:
print(version("numpy").split(".")[0])
except importlib.metadata.PackageNotFoundError:
print("-1")
| 2301_81996401/term-sd | python_modules/get_numpy_ver.py | Python | agpl-3.0 | 177 |
import re
import sys
import subprocess
try:
output = subprocess.check_output(
[sys.executable, "-m", "pip", "cache", "info"], text=True
)
except Exception as _:
output = []
try:
uv_output = subprocess.check_output(["uv", "cache", "dir"], text=True)
except Exception as _:
uv_output = ""
... | 2301_81996401/term-sd | python_modules/get_pip_cache_info.py | Python | agpl-3.0 | 976 |
import sys
p = sys.platform
if p in ["win32", "linux", "darwin"]:
print(p)
else:
print("other")
| 2301_81996401/term-sd | python_modules/get_platform.py | Python | agpl-3.0 | 106 |
import importlib.metadata
import pathlib
package = "pypatchmatch"
try:
# dist = importlib.metadata.files("ll")
util = [p for p in importlib.metadata.files(package) if "__init__.py" in str(p)][0]
path = pathlib.Path(util.locate()).parents[0]
print(path.as_posix())
except importlib.metadata.PackageNotFo... | 2301_81996401/term-sd | python_modules/get_pypatchmatch_path.py | Python | agpl-3.0 | 348 |
import re
import argparse
import subprocess
from importlib.metadata import requires
from typing import Literal
DeviceType = Literal["cuda", "rocm", "xpu", "cpu"]
def get_args() -> argparse.Namespace:
"""获取命令行参数
:return `argparse.Namespace`: 命令行参数命名空间
"""
parser = argparse.ArgumentParser()
pars... | 2301_81996401/term-sd | python_modules/get_pytorch_mirror_type.py | Python | agpl-3.0 | 11,717 |
def get_pytorch_version() -> str | None:
"""获取 PyTorch 的版本号
:return `str|None`: PyTorch 版本号
"""
try:
import torch
return torch.__version__
except Exception as _:
return None
def get_pytorch_type() -> str:
"""获取 PyTorch 版本号对应的类型
:return `str`: PyTorch 类型
"""
... | 2301_81996401/term-sd | python_modules/get_pytorch_type.py | Python | agpl-3.0 | 1,066 |
from importlib.metadata import version
try:
print(version("torch"))
except:
print("无")
| 2301_81996401/term-sd | python_modules/get_pytorch_ver.py | Python | agpl-3.0 | 98 |
import argparse
import json
from pathlib import Path
# 参数输入
def get_args():
parser = argparse.ArgumentParser()
normalized_filepath = lambda filepath: str(Path(filepath).absolute().as_posix())
parser.add_argument(
"--config-path",
type=normalized_filepath,
default=None,
hel... | 2301_81996401/term-sd | python_modules/get_sd_webui_disable_all_extension_status.py | Python | agpl-3.0 | 905 |
import os
print(f"{os.getcwd()}{os.pathsep}{os.environ.get('PYTHONPATH', '')}")
| 2301_81996401/term-sd | python_modules/get_sd_webui_python_path.py | Python | agpl-3.0 | 81 |
from importlib.metadata import version
try:
print(version("xformers"))
except:
print("无")
| 2301_81996401/term-sd | python_modules/get_xformers_ver.py | Python | agpl-3.0 | 101 |
import os
import sys
import json
import copy
import shlex
import inspect
import logging
import argparse
import traceback
import subprocess
from pathlib import Path
from typing import Optional
def get_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(
description="Stable Diffusion WebUI 扩展依赖安装... | 2301_81996401/term-sd | python_modules/install_sd_webui_extension_requirement.py | Python | agpl-3.0 | 9,175 |
import re
import sys
from invokeai.app.run_app import run_app
if __name__ == "__main__":
sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
sys.exit(run_app())
| 2301_81996401/term-sd | python_modules/launch_invokeai.py | Python | agpl-3.0 | 183 |
import os
import json
import argparse
from pathlib import Path
def get_args():
parser = argparse.ArgumentParser()
normalized_filepath = lambda filepath: str(Path(filepath).absolute().as_posix())
parser.add_argument(
"--config-path",
type=normalized_filepath,
default=None,
... | 2301_81996401/term-sd | python_modules/set_sd_webui_extension_status.py | Python | agpl-3.0 | 2,655 |
"""运行环境检查"""
import re
import os
import sys
import copy
import logging
import argparse
import importlib.metadata
from collections import namedtuple
from pathlib import Path
from typing import Optional, TypedDict, Union
def get_args() -> argparse.Namespace:
"""获取命令行参数输入参数输入"""
parser = argparse.ArgumentParser... | 2301_81996401/term-sd | python_modules/validate_requirements.py | Python | agpl-3.0 | 31,440 |
#!/bin/bash
# Term-SD 启动参数处理
# 设置 TERM_SD_SCRIPT_NAME 全局变量读取要启动的 Term-SD 扩展脚本
term_sd_launch_arg_parse() {
local argument_input
local argument
local i
# 用别的方法实现了 getopt 命令的功能
# 加一个 --null 是为了增加一次循环, 保证那些需要参数的选项能成功执行
for i in "$@" "--null"; do
argument=$i # 用作判断是参数还是选项
# 参数检测部分... | 2301_81996401/term-sd | term-sd.sh | Shell | agpl-3.0 | 65,133 |
__version__ = '1.5.0'
__description__ = 'Monitors, analyzes and limits the bandwidth of devices on the local network' | 2301_82206160/evillimite | evillimiter/__init__.py | Python | mit | 117 |
import evillimiter.console.shell as shell
BROADCAST = 'ff:ff:ff:ff:ff:ff'
BIN_TC = shell.locate_bin('tc')
BIN_IPTABLES = shell.locate_bin('iptables')
BIN_SYSCTL = shell.locate_bin('sysctl')
IP_FORWARD_LOC = 'net.ipv4.ip_forward' | 2301_82206160/evillimite | evillimiter/common/globals.py | Python | mit | 231 |
from .io import IO
_MAIN_BANNER = r"""{}
███████╗██╗ ██╗██╗██╗ ██╗ ██╗███╗ ███╗██╗████████╗███████╗██████╗
██╔════╝██║ ██║██║██║ ██║ ██║████╗ ████║██║╚══██╔══╝██╔════╝██╔══██╗
█████╗ ██║ ██║██║██║ ██║ ██║██╔████╔██║██║ ██║ █████╗ ██████╔╝
██╔══╝ ╚██╗ ██╔╝██║██║ ██║ ... | 2301_82206160/evillimite | evillimiter/console/banner.py | Python | mit | 1,519 |
from evillimiter.console.io import IO
class BarChart(object):
def __init__(self, draw_char='▇', max_bar_length=30):
self.draw_char = draw_char
self.max_bar_length = max_bar_length
self._data = []
def add_value(self, value, prefix, suffix=''):
self._data.append({ 'valu... | 2301_82206160/evillimite | evillimiter/console/chart.py | Python | mit | 1,304 |
import re
import colorama
from . import shell
class IO(object):
_ANSI_CSI_RE = re.compile('\001?\033\\[((?:\\d|;)*)([a-zA-Z])\002?')
Back = colorama.Back
Fore = colorama.Fore
Style = colorama.Style
colorless = False
@staticmethod
def initialize(colorless=False):
"""
In... | 2301_82206160/evillimite | evillimiter/console/io.py | Python | mit | 1,847 |
import os
import subprocess
from evillimiter.console.io import IO
DEVNULL = open(os.devnull, 'w')
def execute(command, root=True):
return subprocess.call('sudo ' + command if root else command, shell=True)
def execute_suppressed(command, root=True):
return subprocess.call('sudo ' + command if root else com... | 2301_82206160/evillimite | evillimiter/console/shell.py | Python | mit | 888 |
import re
import os
import os.path
import argparse
import platform
import collections
import pkg_resources
import evillimiter.networking.utils as netutils
from evillimiter.menus.main_menu import MainMenu
from evillimiter.console.banner import get_main_banner
from evillimiter.console.io import IO
InitialArguments = c... | 2301_82206160/evillimite | evillimiter/evillimiter.py | Python | mit | 5,700 |
import time
import socket
import curses
import netaddr
import threading
import collections
from terminaltables import SingleTable
import evillimiter.networking.utils as netutils
from .menu import CommandMenu
from evillimiter.networking.utils import BitRate
from evillimiter.console.io import IO
from evillim... | 2301_82206160/evillimite | evillimiter/menus/main_menu.py | Python | mit | 28,519 |
import enum
import collections
from .parser import CommandParser
from evillimiter.console.io import IO
class CommandMenu(object):
def __init__(self):
self.prompt = '>>> '
self.parser = CommandParser()
self._active = False
def argument_handler(self, args):
"""
Handles ... | 2301_82206160/evillimite | evillimiter/menus/menu.py | Python | mit | 1,180 |
import enum
import collections
from evillimiter.console.io import IO
class CommandParser(object):
class CommandType(enum.Enum):
PARAMETER_COMMAND = 1
FLAG_COMMAND = 2
PARAMETERIZED_FLAG_COMMAND = 3
FlagCommand = collections.namedtuple('FlagCommand', 'type, identifier, name')
Para... | 2301_82206160/evillimite | evillimiter/menus/parser.py | Python | mit | 5,965 |
from evillimiter.console.io import IO
class Host(object):
def __init__(self, ip, mac, name):
self.ip = ip
self.mac = mac
self.name = name
self.spoofed = False
self.limited = False
self.blocked = False
self.watched = False
def __eq__(self, other):
... | 2301_82206160/evillimite | evillimiter/networking/host.py | Python | mit | 414 |
import threading
import evillimiter.console.shell as shell
from .host import Host
from evillimiter.common.globals import BIN_TC, BIN_IPTABLES
from evillimiter.console.io import IO
class Limiter(object):
class HostLimitIDs(object):
def __init__(self, upload_id, download_id):
self.up... | 2301_82206160/evillimite | evillimiter/networking/limit.py | Python | mit | 8,379 |
import time
import threading
from scapy.all import sniff, IP # pylint: disable=no-name-in-module
from .utils import ValueConverter, BitRate, ByteValue
class BandwidthMonitor(object):
class BandwidthMonitorResult(object):
def __init__(self):
self.upload_rate = BitRate()
... | 2301_82206160/evillimite | evillimiter/networking/monitor.py | Python | mit | 3,474 |
import sys
import socket
import threading
import collections
from tqdm import tqdm
from netaddr import IPAddress
from scapy.all import sr1, ARP # pylint: disable=no-name-in-module
from concurrent.futures import ThreadPoolExecutor
from .host import Host
from evillimiter.console.io import IO
class HostScanner(... | 2301_82206160/evillimite | evillimiter/networking/scan.py | Python | mit | 3,735 |
import time
import threading
from scapy.all import ARP, send # pylint: disable=no-name-in-module
from .host import Host
from evillimiter.common.globals import BROADCAST
class ARPSpoofer(object):
def __init__(self, interface, gateway_ip, gateway_mac):
self.interface = interface
self.gateway_ip = g... | 2301_82206160/evillimite | evillimiter/networking/spoof.py | Python | mit | 2,330 |
import re
import netifaces
from scapy.all import ARP, sr1 # pylint: disable=no-name-in-module
import evillimiter.console.shell as shell
from evillimiter.common.globals import BIN_TC, BIN_IPTABLES, BIN_SYSCTL, IP_FORWARD_LOC
def get_default_interface():
"""
Returns the default IPv4 interface
""... | 2301_82206160/evillimite | evillimiter/networking/utils.py | Python | mit | 8,088 |
import time
import threading
from .scan import HostScanner, ScanIntensity
class HostWatcher(object):
def __init__(self, interface, iprange, reconnection_callback):
self._scanner = HostScanner(interface, iprange)
self._reconnection_callback = reconnection_callback
self._hosts = set()
... | 2301_82206160/evillimite | evillimiter/networking/watch.py | Python | mit | 2,708 |
import os
import re
from setuptools import setup, find_packages, Command
class CleanCommand(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
os.system('rm -vrf ./build ./dist ./*.pyc ./*.pyo ./*.pyd ./*.tgz ./*.e... | 2301_82206160/evillimite | setup.py | Python | mit | 2,682 |
#pragma once
#include "../Base/BaseData.hpp"
using namespace base;
template <typename TArray, typename TElemType>
class MasterArray {
public:
virtual Status initArray(TArray& a, int n) = 0;
virtual Status destoryArray(TArray& a) = 0;
virtual Status Value(const TArray a, TElemType& e) = 0;
virtual Sta... | 2301_82205515/CppDataLearn | Array/MasterArray.hpp | C++ | unknown | 363 |
#pragma once
#include <string>
namespace base {
const int IntDefault = 0;
const char CharDefault = '\0';
const std::string StrDefault = "\0";
const int StringMaxSize = 255;
const int QueueMaxSize = 100;
const int ListMaxSize = 100;
const int TreeMaxSize = 100;
enum Status {
Ok,
Err,
};
}
| 2301_82205515/CppDataLearn | Base/BaseData.hpp | C++ | unknown | 302 |
#ifndef LINK_LIST_HPP
#define LINK_LIST_HPP
#include <cstddef>
typedef int LElemType;
typedef struct Node {
LElemType data;
struct Node* next;
} Node, *LinkedList;
typedef enum {
Ok,
Err
} Status;
class LinkList {
public:
LinkList(LElemType e)
{
l = new Node;
l->data = e;
... | 2301_82205515/CppDataLearn | LinkList.hpp | C++ | unknown | 1,648 |
#ifndef DULINK_LIST_HPP
#define DULINK_LIST_HPP
#include "MasterList.hpp"
typedef int ElemType;
typedef struct DuLNode{
ElemType data;
struct DuLNode *prior;
struct DuLNode *next;
}DuLNode, *DuLinkList;
class DuLinkListC : public MasterList<DuLinkList, ElemType>{
public:
};
#endif
| 2301_82205515/CppDataLearn | List/DuLinkList.hpp | C++ | unknown | 300 |
#pragma once
#include "MasterList.hpp"
#include <iostream>
#include <cstdlib>
typedef int ElemType;
const ElemType Default = 0;
typedef struct LNode {
ElemType data;
struct LNode* next;
} LNode, *LinkList;
class LinkListC : public MasterList<LinkList, ElemType> {
private:
LinkList temp;
public:
St... | 2301_82205515/CppDataLearn | List/LinkList.hpp | C++ | unknown | 4,379 |
#pragma once
#include "../Base/BaseData.hpp"
using namespace base;
template <typename TList, typename TElemType>
class MasterList {
public:
virtual ~MasterList() = default;
virtual Status initList(TList& l) = 0;
virtual Status destoryList(TList& l) = 0;
virtual Status clearList(TList& l) = 0;
vi... | 2301_82205515/CppDataLearn | List/MasterList.hpp | C++ | unknown | 894 |
#pragma once
#include "MasterList.hpp"
#include <iostream>
#include <cstdlib>
typedef int ElemType;
typedef struct {
ElemType* elem;
int length;
} SqList;
class SqListC : public MasterList<SqList, ElemType> {
public:
Status initList(SqList& l) override
{
l.elem = new ElemType[ListMaxSize];
... | 2301_82205515/CppDataLearn | List/SqList.hpp | C++ | unknown | 2,962 |
#ifndef DEQUE_HPP
#define DEQUE_HPP
#include "SqQueue.hpp"
class Deque : public SqQueueC {
public:
Deque() {
initQueue(q);
}
Status deFront(QElemType &e) {
deQueue(q, e);
return Status::Ok;
}
Status deRear(QElemType &e) {
if (queueEmpty(q)) {
return S... | 2301_82205515/CppDataLearn | Queue/Deque.hpp | C++ | unknown | 902 |
#ifndef LINK_QUEUE_HPP
#define LINK_QUEUE_HPP
#include "MasterQueue.hpp"
#include <cstddef>
#include <cstdlib>
#include <iostream>
typedef int QElemType;
typedef struct QNode {
QElemType data;
struct QNode* next;
} QNode, *QueuePtr;
typedef struct
{
QueuePtr front;
QueuePtr rear;
} LinkQueue;
clas... | 2301_82205515/CppDataLearn | Queue/LinkQueue.hpp | C++ | unknown | 2,367 |
#ifndef MASTER_QUEUE_HPP
#define MASTER_QUEUE_HPP
#include "../Base/BaseData.hpp"
using namespace base;
template<typename TQueue, typename TElemType>
class MasterQueue {
public:
virtual ~MasterQueue() = default;
virtual Status initQueue(TQueue &q) = 0;
virtual Status destoryQueue(TQueue &q) = 0;
vir... | 2301_82205515/CppDataLearn | Queue/MasterQueue.hpp | C++ | unknown | 683 |
#ifndef REAR_QUEUE_HPP
#define REAR_QUEUE_HPP
#include "LinkQueue.hpp"
#include <iostream>
#include <ostream>
typedef struct
{
QueuePtr rear;
} rearQueue;
class RearQueue : public LinkQueueC {
private:
rearQueue q;
public:
RearQueue()
{
initRearQueue();
}
Status initRearQueue()
... | 2301_82205515/CppDataLearn | Queue/RearQueue.hpp | C++ | unknown | 1,358 |
#ifndef SQ_QUEUE_HPP
#define SQ_QUEUE_HPP
#include "MasterQueue.hpp"
#include <iostream>
#include <cstdlib>
typedef int QElemType;
typedef struct {
QElemType* base;
int front;
int rear;
} Queue;
class SqQueueC: public MasterQueue<Queue, QElemType> {
public:
Status initQueue(Queue& q) override
... | 2301_82205515/CppDataLearn | Queue/SqQueue.hpp | C++ | unknown | 1,968 |
#ifndef TAG_QUEUE_HPP
#define TAG_QUEUE_HPP
#include "SqQueue.hpp"
class TagQueue : public SqQueueC {
public:
TagQueue() {
initQueue(q);
tag = 0;
}
bool isEmpty() {
return queueEmpty(q) && tag == 0;
}
bool isFull() {
return queueEmpty(q) && tag == 1;
}
St... | 2301_82205515/CppDataLearn | Queue/TagQueue.hpp | C++ | unknown | 933 |
#ifndef LINK_STACK_HPP
#define LINK_STACK_HPP
#include "MasterStack.hpp"
#include "SqStack.hpp"
typedef int ElemType;
typedef struct StackNode{
ElemType data;
struct StackNode *next;
} StackNode, *LinkStack;
class LinkStackC : public MasterStack<LinkStack, ElemType>{
public:
};
#endif
| 2301_82205515/CppDataLearn | Stack/LinkStack.hpp | C++ | unknown | 305 |
#ifndef MASTER_STACK_HPP
#define MASTER_STACK_HPP
#include "../Base/BaseData.hpp"
using namespace base;
template <typename TStack, typename TElemType>
class MasterStack {
public:
virtual ~MasterStack() = default;
virtual Status initStack(TStack &s) = 0;
virtual Status destoryStack(TStack &s) = 0;
vi... | 2301_82205515/CppDataLearn | Stack/MasterStack.hpp | C++ | unknown | 677 |
#ifndef SQ_STACK_HPP
#define SQ_STACK_HPP
#include "MasterStack.hpp"
typedef int ElemType;
typedef struct {
ElemType* base;
ElemType* top;
int stacksize;
} SqStack;
class SqStackC : public MasterStack<SqStack, ElemType> {
public:
};
#endif
| 2301_82205515/CppDataLearn | Stack/SqStack.hpp | C++ | unknown | 257 |
#ifndef H_STRING_HPP
#define H_STRING_HPP
#include "MasterString.hpp"
#define MAXSIZE 255
typedef struct {
char* ch;
int length;
}HString;
class HStringC : public MasterString<HString>{
public:
};
#endif
| 2301_82205515/CppDataLearn | String/HString.hpp | C++ | unknown | 219 |
#ifndef L_STRING_HPP
#define L_STRING_HPP
#include "MasterString.hpp"
using namespace base;
typedef struct Chunk {
char ch[StringMaxSize];
struct Chunk *next;
} Chunk;
typedef struct {
Chunk *head, *tail;
int length;
}LString;
class LStringC : public MasterString<LString> {
public:
};
#endif
| 2301_82205515/CppDataLearn | String/LString.hpp | C++ | unknown | 315 |
#ifndef MASTER_STRING_HPP
#define MASTER_STRING_HPP
#include "../Base/BaseData.hpp"
using namespace base;
template <typename TString>
class MasterString {
public:
enum CompareE {
Less = -1,
Equal = 0,
More = 1,
};
virtual ~MasterString() = default;
virtual Status strAssign(T... | 2301_82205515/CppDataLearn | String/MasterString.hpp | C++ | unknown | 1,119 |
#ifndef S_STRING_HPP
#define S_STRING_HPP
#include "MasterString.hpp"
#include <cstring>
#define MAXSIZE 255
typedef struct {
char ch[MAXSIZE + 1];
int length;
} SString;
class SStringC : public MasterString<SString> {
protected:
public:
Status strAssign(SString& t, const char* chars) override
... | 2301_82205515/CppDataLearn | String/SString.hpp | C++ | unknown | 3,504 |
#pragma once
#include "MasterBinaryTree.hpp"
#include <cctype>
#include <stack>
#include <vector>
typedef int ElemType;
typedef struct BiNode {
ElemType data;
struct BiNode *lchild, *rchild;
} BiNode, *BiTree;
class LinkBiTree : public MasterBinaryTree<BiTree, ElemType> {
public:
Status initBiTree(BiTre... | 2301_82205515/CppDataLearn | Tree/LinkBiTree.hpp | C++ | unknown | 2,890 |
#pragma once
#include "../Base/BaseData.hpp"
using namespace base;
template <typename TTree, typename TElemType>
class MasterBinaryTree {
public:
virtual ~MasterBinaryTree() = default;
virtual Status initBiTree(TTree& t) = 0;
virtual Status destoryBiTree(TTree& t) = 0;
virtual Status createBiTree(TT... | 2301_82205515/CppDataLearn | Tree/MasterBinaryTree.hpp | C++ | unknown | 1,322 |
#pragma once
#include "MasterBinaryTree.hpp"
typedef int ElemType ;
typedef ElemType SqBiTree[TreeMaxSize];
| 2301_82205515/CppDataLearn | Tree/SqBiTree.hpp | C++ | unknown | 112 |
#include "../Queue/Deque.hpp"
#include "../LinkList.hpp"
#include "../Queue/LinkQueue.hpp"
#include "../Queue/RearQueue.hpp"
#include "../Queue/TagQueue.hpp"
#include <iostream>
using namespace std;
void hw4_1()
{
RearQueue rq;
cout << "队列是否为空?" << (rq.rearQueueEmpty() ? "是" : "否") << endl;
rq.enRearQu... | 2301_82205515/CppDataLearn | example/hw4.cpp | C++ | unknown | 1,923 |
#include "../String/SString.hpp"
#include <cstring>
#include <fstream>
#include <iostream>
#include <iterator>
using namespace std;
void question1()
{
SStringC proceesor;
SString str;
proceesor.strAssign(str, "2468_WE_ARE_APPRECIATE_BBNO$");
int values[36] = { 0 };
char* temp = str.ch;
while... | 2301_82205515/CppDataLearn | example/hw5.cpp | C++ | unknown | 2,477 |
#include <cctype>
#include <iostream>
#include <stack>
using namespace std;
typedef struct BiNode {
char data;
struct BiNode *lchild, *rchild;
} BiNode, *BiTree;
bool In(char ch);
char GetTop(stack<char> s);
int Precede(char op1, char op2);
void CreateExpTree(BiTree& T, BiTree a, BiTree b, char theta);
i... | 2301_82205515/CppDataLearn | example/st4_22.cpp | C++ | unknown | 3,711 |
<script>
export default {
onLaunch: function() {
console.log('App Launch')
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style>
/*每个页面公共css */
</style>
| 2301_82115348/VendingMachine_1023 | App.vue | Vue | unknown | 254 |
function formatMsg(tag, msg){
const time = new Date().toLocaleTimeString();
return `${tag}${time}${msg}`;
}
export default{
info(tag, msg){
console.log(`[INFO] ${formatMsg(tag,msg)}`);
},
error(tag,msg){
console.error(`[ERROR] ${formatMsg(tag,msg)}`);
}
} | 2301_82115348/VendingMachine_1023 | components/log/log.js | JavaScript | unknown | 268 |
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-wi... | 2301_82115348/VendingMachine_1023 | index.html | HTML | unknown | 675 |
import App from './App'
// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()
// #endif
// #ifdef VUE3
import { createSSRApp } from 'vue'
import log from "./components/log/log.js"
import constant from ... | 2301_82115348/VendingMachine_1023 | main.js | JavaScript | unknown | 527 |
export default {
BASE_URL: "https://vending.neumooc.com/prod-api/",
MACHINE_NO: "49f4b29ccfcb4207a35e73327f7cb0b2"
} | 2301_82115348/VendingMachine_1023 | models/constant.js | JavaScript | unknown | 118 |
export default class Product {
constructor(id, name, price, imageUrl, stock) {
this.id = id;
this.name = name;
this.price = price;
this.imageUrl = imageUrl;
this.stock = stock;
}
} | 2301_82115348/VendingMachine_1023 | models/product.js | JavaScript | unknown | 192 |