-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
144 lines (142 loc) · 5.05 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
$time_start = microtime(true);
define('ROOT', dirname(__FILE__).'/');
define('MATCH_LENGTH', 0.1*1024*1024); //字符串长度 0.1M 自己设置,一般够了。
define('RESULT_LIMIT',100);
function my_scandir($path){//获取数据文件地址
$filelist=array();
if($handle=opendir($path)){
while (($file=readdir($handle))!==false){
if($file!="." && $file !=".."){
if(is_dir($path."/".$file)){
$filelist=array_merge($filelist,my_scandir($path."/".$file));
}else{
$filelist[]=$path."/".$file;
}
}
}
}
closedir($handle);
return $filelist;
}
function get_results($keyword){//查询
$return=array();
$count=0;
$datas=my_scandir(ROOT."kieoidfrwq!!1123@#fewf"); //数据库文档目录
if(!empty($datas))foreach($datas as $filepath){
$filename = basename($filepath);
$start = 0;
$fp = fopen($filepath, 'r');
while(!feof($fp)){
fseek($fp, $start);
$content = fread($fp, MATCH_LENGTH);
$content.=(feof($fp))?"\n":'';
$content_length = strrpos($content, "\n");
$content = substr($content, 0, $content_length);
$start += $content_length;
$end_pos = 0;
while (($end_pos = strpos($content, $keyword, $end_pos)) !== false){
$start_pos = strrpos($content, "\n", -$content_length + $end_pos);
$start_pos = ($start_pos === false)?0:$start_pos;
$end_pos = strpos($content, "\n", $end_pos);
$end_pos=($end_pos===false)?$content_length:$end_pos;
$return[]=array(
'f'=>$filename,
't'=>trim(substr($content, $start_pos, $end_pos-$start_pos))
);
$count++;
if ($count >= RESULT_LIMIT) break;
}
unset($content,$content_length,$start_pos,$end_pos);
if ($count >= RESULT_LIMIT) break;
}
fclose($fp);
if ($count >= RESULT_LIMIT) break;
}
return $return;
}
if(!empty($_POST)&&!empty($_POST['q'])){
set_time_limit(0); //不限定脚本执行时间
$q=strip_tags(trim($_POST['q']));
$results=get_results($q);
$count=count($results);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>SGKst</title>
<link rel="stylesheet" type="text/css" href="css/default.css" />
<style type="text/css">
body,td,th{
color: #FFF;
}
a:link{
color: #0C0;
text-decoration: none;
}
body{
background-color: #000;
}
a:visited {
text-decoration: none;
color: #999;
}
a:hover{
text-decoration: none;
}
a:active{
text-decoration: none;
color: #F00;
}
</style>
<script>
<!--
function check(form){
if(form.q.value==""){
alert("Not null!");
form.q.focus();
return false;
}
}
-->
</script>
</head>
<body>
<div id="container"><div id="header"><a href="http://www.baidu.com" ><h1>Social Engineering Data</h1></a></div><br /><br />
<form name="from" action="index.php" method="post">
<div id="content">
<div id="create_form">
<label>Please input Keyword:<input class="inurl" size="26" id="unurl" name="q" value="<?php echo !empty($q)?$q:''; ?>"/></label>
<p class="ali"><label for="alias">Key Words:</label><span>User,Email,QQ Account,Forum Account...</span></p>
<p class="but"><input onClick="check(form)" type="submit" value="Search" class="submit" /></p>
</form>
</div>
<?php
if(isset($count))
{
echo 'Get ' .$count .' results, cost ' . (microtime(true) - $time_start) . " seconds";
if(!empty($results)){
echo '<ul>';
foreach($results as $v){
echo '<li>From_['.$v['f'].']_Datas <br />Content: '.$v['t'].'</li><br />';
}
echo '<br /><br /><font color=#ffff00><li>Resources from the Internet.<br />The information here does not represent the views of this site.</li></font>';
echo '</ul>';
}
echo '<hr align="center" width="550" color="#2F2F2F" size="1"><font color="#ff0000">We cannot guarantee the entirely accurate,please voluntarily judge.';
echo '<br />The data is not complete? Do you want to add or remove it?';
echo '<br />Contact Email:[email protected]</font>';
echo '</ul>';
}
?>
<div id="nav">
<ul><li class="current"><a href="#">Search Data</a></li><li><a href="html/about.html" target="_blank">Abouts</a></li></ul>
</div>
<div id="footer">
<p>Social Engineering Data ©2010-2013 Powered By <a href="#" target="_blank">SGKst<a></p><div style="display:none">
</div>
</div>
</body>
</html>