-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscan.php
More file actions
63 lines (42 loc) · 1.33 KB
/
scan.php
File metadata and controls
63 lines (42 loc) · 1.33 KB
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
<?php
require 'classes/scan_jobs.php';
//return;
$start_time = microtime(true);
if ($argc <= 1) return;
for ($j = 1; $j < $argc; $j++)
{
$scan_class = $argv[$j];
echo 'Begin '.$scan_class." scan\r\n";
$scan_start_time = microtime(true);
for ($i = 0; $i < count($scan_class::$data); $i++)
{
$scan = new $scan_class($i);
$scan->run();
my_file_put_contents($scan->filename, $scan->contents);
}
git_commit('Autobot '.$scan_class.' commit');
echo 'End '.$scan_class.' scan. Total elapsed time: ' . round(microtime(true)-$scan_start_time, 3) . " seconds\r\n\r\n";
}
git_push();
echo 'End scan. Total elapsed time: ' . round(microtime(true)-$start_time, 3) . " seconds\r\n\r\n";
function my_file_put_contents($filename, $contents)
{
echo 'Writing file to: scans/'.$filename.' Length: '.strlen($contents)."\r\n";
file_put_contents('scans/'.$filename, $contents);
}
function git_commit($message = 'Autobot commit')
{
echo "\r\n";
echo "git add -A scans/";
echo exec('git add -A scans/') . "\r\n";
echo 'git commit -m "'.$message.'"'."\r\n";
echo "\t" . exec('git commit -m "'.$message.'"') . "\r\n";
echo "\r\n";
}
function git_push()
{
echo "\r\n";
echo "git push origin master\r\n";
echo "\t" . exec('git push origin master') . "\r\n";
echo "\r\n";
}