• R/O
  • SSH
  • HTTPS

masspie: Commit


Commit MetaInfo

Revision19 (tree)
Zeit2020-02-17 19:05:38
Autorelge

Log Message

re-factor validptr --> checkiprev

Ändern Zusammenfassung

Diff

--- validptr.bash (revision 18)
+++ validptr.bash (nonexistent)
@@ -1,78 +0,0 @@
1-#!/bin/bash
2-
3-debug=0
4-
5-[[ ! -f massp25.og ]] && echo missing file massp25.og && exit 1
6-input=massp25.og
7-
8-function validptr {
9- (( debug == 1 )) && echo ip is $ip
10-
11- #need to separate the commands to get the first return code
12- ptrstr=`host $ip` || continue
13- #{ echo DEBUG: ip is $ip; continue; }
14-
15- #we need to avoid backslash escaped foreign chars e.g.
16- #\233\155\187\232\133\166\229\174\164003.ktnp.gov.tw.
17- #we also don't want weird PTRs that would eventually validate iprev
18- #^R9d^O9^R8^A91^K8^R9^A89~-a.ktnp.gov.tw
19- #*.highrockhosting7.com
20- ptr=`echo $ptrstr | awk '{print $NF}' | grep -E '^[[:alnum:]._-]+$'`
21-
22- [[ -z $ptr ]] && echo weird Z ptr on ip $ip >> $piece.weird && continue
23- [[ $ptr = "" ]] && echo weird EMPTY ptr on ip $ip >> $piece.weird && continue
24- (( debug == 1 )) && echo ptr is $ptr
25-
26- hostipstr=`host $ptr`
27- #{ echo DEBUG: ptr is $ptr; continue; }
28- hostip=`echo $hostipstr | awk '{print $NF}'`
29- (( debug == 1 )) && echo hostip is $hostip
30-
31- if [[ $ip = $hostip ]]; then
32- printf "$ip\t${ptr%\.}\tiprev\n"
33- else
34- printf "$ip\t${ptr%\.}\tnoiprev\n"
35- fi
36-}
37-
38-function processpiece {
39- echo writing to $piece.ptr
40- time for ip in `cat $piece`; do
41- validptr &
42- done > && echo wrote to $piece.ptr || echo $piece.ptr FAIL; unset ip
43-}
44-
45-echo writing to $input.ip ...
46-grep -v ^# $input | awk '{print $4}' $input > $input.ip && echo done
47-
48-echo DEBUG - PRESS CTRL-C
49-read
50-
51-echo -n entering splitted/ ...
52-mkdir -p splitted/
53-cd splitted/ && echo done
54-
55-echo -n splitting $input.ip into 127 pieces...
56-split -a3 -d -nl/127 ../$input.ip $input.ip && echo done
57-
58-echo iprev check starts `date`
59-echo "writing to $iprev $noiprev $weird"
60-rm -f $iprev $noiprev $weird
61-#sort -V -k4
62-for piece in $input[0-9][0-9][0-9]; do
63- processpiece &
64-done; unset piece
65-ps auxfww | grep validptr | grep -v grep
66-time wait
67-echo iprev check ends `date`
68-
69-#getting all PTRs in one place, sorting and sanitizing
70-echo -n writing to ptr.unique ...
71-#sed 's/\.$//'
72-#grep -E '^[[:alnum:]._-]+$'
73-time cut -f2 ../*.ptr | sort --version-sort -u > ptr.unique && echo done
74-
75-#iprev=massp25.iprev
76-#noiprev=massp25.noiprev
77-#weird=massp25.weird
78-
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
--- checkiprev.bash (nonexistent)
+++ checkiprev.bash (revision 19)
@@ -0,0 +1,100 @@
1+#!/bin/bash
2+
3+debug=0
4+
5+function checkiprev {
6+ (( debug == 1 )) && echo ip is $ip
7+ [[ -z $ip ]] && echo function $0 requires \$ip && exit 1
8+
9+ #need to separate the commands to get the first return code
10+ ptrstr=`host $ip` || continue
11+ #{ echo DEBUG: ip is $ip; continue; }
12+
13+ #we need to avoid backslash escaped foreign chars e.g.
14+ #\233\155\187\232\133\166\229\174\164003.ktnp.gov.tw.
15+ #we also don't want weird PTRs that would eventually validate iprev
16+ #^R9d^O9^R8^A91^K8^R9^A89~-a.ktnp.gov.tw
17+ #*.highrockhosting7.com
18+ ptr=`echo $ptrstr | awk '{print $NF}' | grep -E '^[[:alnum:]._-]+$'`
19+
20+ [[ -z $ptr ]] && echo weird Z ptr on ip $ip >> $piece.weird && continue
21+ [[ $ptr = "" ]] && echo weird EMPTY ptr on ip $ip >> $piece.weird && continue
22+ (( debug == 1 )) && echo ptr is $ptr
23+
24+ hostipstr=`host $ptr`
25+ #{ echo DEBUG: ptr is $ptr; continue; }
26+ hostip=`echo $hostipstr | awk '{print $NF}'`
27+ (( debug == 1 )) && echo hostip is $hostip
28+
29+ if [[ $ip = $hostip ]]; then
30+ printf "$ip\t${ptr%\.}\tiprev\n"
31+ else
32+ printf "$ip\t${ptr%\.}\tnoiprev\n"
33+ fi
34+}
35+
36+function processpiece {
37+ for ip in `cat $piece`; do
38+ checkiprev
39+ done > $piece.ptr && echo wrote to $piece.ptr || echo $piece.ptr FAIL; unset ip
40+}
41+
42+[[ ! -f massp25.og ]] && echo missing file massp25.og && exit 1
43+
44+#don't ask how masscan could deliver duplicates
45+#11370506 massp25.og.ip
46+#11328069 massp25.og.ip.sort
47+if [[ ! -f massp25.og.ip.sort ]]; then
48+ echo -n writing unique ip addresses to massp25.og.ip.sort ...
49+ grep -v ^# massp25.og | awk '{print $4}' | sort --version-sort -u > massp25.og.ip.sort && echo done
50+ #sort -V -k4
51+fi
52+wc -l massp25.og.ip.sort
53+
54+echo -n entering splitted/ ...
55+mkdir -p splitted/
56+cd splitted/ && echo done
57+
58+if [[ ! -f ip109 ]]; then
59+ echo -n splitting massp25.og.ip.sort into 110 pieces...
60+ split -a3 -d -nl/110 ../massp25.og.ip.sort ip && echo done
61+fi
62+wc -l ip109
63+
64+echo $0 starts `date`
65+for piece in ip[0-9][0-9][0-9]; do
66+ processpiece &
67+done; unset piece
68+#for x in `seq -w 000 050`; do
69+# piece=ip$x
70+# processpiece &
71+#done; unset x
72+(( debug == 1 )) && jobs
73+echo -n "processes: "
74+pgrep checkiprev | wc -l
75+cat <<EOF
76+
77+check with
78+
79+ ps auxfww | grep checkiprev | grep -v grep | less
80+
81+EOF
82+time wait
83+echo $0 ends `date`
84+
85+echo DEBUG - PRESS CTRL-C; read
86+
87+#getting all PTRs in one place, sorting and sanitizing
88+echo -n writing to ptr.unique ...
89+#sed 's/\.$//'
90+#grep -E '^[[:alnum:]._-]+$'
91+cut -f2 ../*.ptr | sort --version-sort -u > ptr.unique && echo done
92+
93+#TODO GETTING ALL IPREV ONLY
94+
95+#echo "writing to $iprev $noiprev $weird"
96+#rm -f $iprev $noiprev $weird
97+#iprev=massp25.iprev
98+#noiprev=massp25.noiprev
99+#weird=massp25.weird
100+
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Show on old repository browser