-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
62 lines (52 loc) · 1.45 KB
/
README
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
<?php
require_once("../src/Sign.php");
$s = new Sign("key");
$data = [
"name" => "Jon",
"age" => "32",
0 => "test"
];
echo $s->generateSign($data)
echo "<br>";
$data = json_encode($data);
echo $s->generateSign($data);
echo "<br>";
//也支持链接调用
$s = new Sign()
echo $s->setKey("key")->generateSign($data);
echo "<br>";
//加解密方法如下
require_once("../src/Tool/Mcrypt.php");
$m = new Tool\Mcrypt();
$str = "Abc!@#$%Z^&*()_+{}|/`http:\/\/";
echo $m->encrypt($str);
echo "<br>";
echo $m->decrypt($m->encrypt($str));
/**
* 遍历目录找查文件
*/
require_once("../src/Tool/EgodicFile.php");
$s = new Tool\EgodicFile();
$path = "/data/www/7723.com/bbs.7723.com";//查找当前目录下的
$exclusions=['.','..','.git','.svn'];//过滤不查找目录
$s->find($path,['png','jpeg','jpg','bmp'],$exclusions);
/**
* openssl加解密类
*/
require_once("../src/Tool/OpensslAes.php");
$str = "test";
//也可以设置加密密钥最长16位
$key = '123456';
Tool\OpensslAes::setKey($key);
$encrypt_str = Tool\OpensslAes::encrypt($str);
$decrypt_str = Tool\OpensslAes::decrypt($encrypt_str);
echo $encrypt_str;
echo $decrypt_str;
/**
* 日志分析
*/
require_once("../src/Tool/OpensslAes.php");
$inputFile = '/usr/local/src/2019-01-30.log';//日志文件
$outputFile = '/usr/local/src/2019-01-30.csv';//分析结果文件
LogAnalysis::setFlowLine(4);//设置日志行流量的列数;默认为4
$res = LogAnalysis::analysisLogFile($inputFile,$outputFile);