1 Star 1 Fork 2

镇海中学开源项目组/fsteal

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.py 1.54 KB
一键复制 编辑 原始数据 按行查看 历史
默一 提交于 2021-08-04 17:03 . The first version
import json
import os
import shutil
import time
config = {}
logt = time.time()
def log(text):
localtime = time.asctime(time.localtime(time.time()))
with open("log" + str(logt) + ".txt", 'a') as file_object:
s="["+localtime+"] "+text+"\n"
print(s)
file_object.write(s)
def copyFile(source, target):
try:
shutil.copyfile(source, target)
log("Success: %s" % source)
except IOError as e:
log("Error: Unable to copy file. %s" % e)
except:
log("Error: Unknown Error while copying %s" % source)
def strContain(source, targets):
for target in targets:
if target in source:
return True
return False
def main():
log("Start...")
try:
with open("config.json") as config_json:
config = json.load(config_json)
except:
log("Error: config.json Not Found!")
log("Exit...")
exit()
if not os.path.isdir(config['target']):
os.mkdir(os.path.join(os.getcwd(), config['target']))
for p in config['path']:
if os.path.isdir(p):
for root, dirs, files in os.walk(p):
if not root == os.path.join(os.getcwd(), config['target']):
for f in files:
if strContain(f, config['symbols']):
copyFile(os.path.join(root, f), os.path.join(
os.getcwd(), os.path.join(config['target'], f)))
else:
log("Error: %s not a folder or driver." % p)
log("Done...")
main()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhzxOpenSource/fsteal.git
[email protected]:zhzxOpenSource/fsteal.git
zhzxOpenSource
fsteal
fsteal
master

搜索帮助