-
Notifications
You must be signed in to change notification settings - Fork 45
/
run_examples.sh
executable file
·60 lines (45 loc) · 1.88 KB
/
run_examples.sh
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
#!/bin/bash
if [ $(whoami) != "root" ];
then
echo "This script needs to run as root"
exit 1
fi
set -e
export PIG_HOME=/opt/pig-0.12.1
export JAVA_HOME=/usr/lib/jvm/java-7-oracle
cd /opt/binarypig
# prepare to run a script
hadoop fs -rmr /tmp/scripts /tmp/yara_rules || true
hadoop fs -put scripts yara_rules /tmp/
# create some sample data using all the src files in "src" dir as input
cd /opt/binarypig/binarypig
mkdir -p /tmp/data
find src -type f -exec cp -f {} /tmp/data/ \;
./bin/dir_to_sequencefile /tmp/data test-files
# run some jobs
cd /opt/binarypig/
pig -f examples/strings.pig -p INPUT=test-files -p OUTPUT=test-files-strings
hadoop fs -ls test-files-strings
hadoop fs -text /user/root/test-files-strings/part-m-00000
pig -f examples/yara_daemon.pig -p INPUT=test-files -p OUTPUT=test-files-yara
hadoop fs -ls test-files-yara
hadoop fs -text /user/root/test-files-yara/part-m-00000
pig -f examples/clamscan.pig -p INPUT=test-files -p OUTPUT=test-files-clamscan
hadoop fs -ls test-files-clamscan
hadoop fs -text /user/root/test-files-clamscan/part-m-00000
pig -f examples/hasher.pig -p INPUT=test-files -p OUTPUT=test-files-hasher
hadoop fs -ls test-files-hasher
hadoop fs -text /user/root/test-files-hasher/part-m-00000
pig -f examples/pehash_deamon.pig -p INPUT=test-files -p OUTPUT=test-files-pehash_deamon
hadoop fs -ls test-files-pehash_deamon
hadoop fs -text /user/root/test-files-pehash_deamon/part-m-00000
PIG_ES_LOAD="pig -f examples/es_load_json.pig
-p INDEX=binarypig
-p ES_CONFIG=/etc/elasticsearch/elasticsearch.yml
-p ES_JAR_DIR=/usr/share/elasticsearch/lib
-p ES_PLUGINS_DIR=/usr/share/elasticsearch/plugins"
# load some of the data into ES
$PIG_ES_LOAD -p INPUT=test-files-yara -p OBJ=yara
$PIG_ES_LOAD -p INPUT=test-files-clamscan -p OBJ=clamscan
$PIG_ES_LOAD -p INPUT=test-files-hasher -p OBJ=hasher
$PIG_ES_LOAD -p INPUT=test-files-pehash -p OBJ=pehash