Skip to content

Commit 8246b35

Browse files
committed
update: add search results output to file
1 parent e5d764a commit 8246b35

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ USAGE:
4141
* v2.0 更新搜索设计和算法
4242
* v2.1 更新搜索结果输出展现
4343
* v2.2 优化部分代码,增加项目搜索进度条,解决代码输出BUG
44-
* v2.4 优化程序目录设计,优化源码实现,删除冗余代码
44+
* v2.4 优化程序目录设计,优化源码实现,增加默认文件输出
4545

4646
***
4747
## Sensitive info scan tool of Github

config/Config.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
FILE_DB = "pattern/file.db"
55
INFO_DB = "pattern/info.db"
66

7+
# Output file default name
8+
OUTPUT_FILE = "gitprey.txt"
9+
710
# GitHub account config for searching
811
USER_NAME = "repoog"
9-
PASSWORD = ""
12+
PASSWORD = "/*F0r0p3nS0urc3*/"

include/ColorPrint.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4+
try:
5+
from config.Config import *
6+
except ImportError:
7+
print "[!_!]ERROR INFO: Can't find Config file for searching."
8+
exit()
49

510
def error_print(string):
611
# Print error information with red color
@@ -15,17 +20,29 @@ def info_print(string):
1520
def project_print(string):
1621
# Print project information with deep green color
1722
print "\033[1;36;40m%s\033[0m" % string
23+
__output_result(string)
1824

1925

2026
def file_print(string):
2127
# Print file url with yellow color
2228
print "\033[1;33;40m%s\033[0m" % string
29+
__output_result(string)
2330

2431

2532
def code_print(string):
2633
# Print code line with white color
2734
print "\033[1;37;40m%s\033[0m" % string
35+
__output_result(string)
2836

2937

38+
def __output_result(string):
39+
"""
40+
Output search results to text file
41+
:param results: search results
42+
:return: None
43+
"""
44+
with open(OUTPUT_FILE, 'a+') as file_obj:
45+
file_obj.write(string + '\r\n')
46+
3047
if __name__ == "__main__":
3148
pass

0 commit comments

Comments
 (0)