Add portscan.r2, add malloc check in anal.c

This commit is contained in:
pancake 2014-05-12 02:15:57 +02:00
parent 52ec7c4376
commit 0fa7ae474a
3 changed files with 57 additions and 0 deletions

14
doc/portscan.r2 Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/r2 -qni portscan.r2 -
# r2 portscanner
# author: pancake
# date: 2013-11-30
f minport=1
f maxport=1024
k host=localhost
(connect host port,=+tcp://$0:`?vi $1`/ 2>/dev/null,?! ?e OPEN `?vi $1`)
(scan host min max,.(connect $0 $$) @@=`?s $1 $2`,?e Report:,=~[2],=-*)
.(scan `k host` minport maxport)
# Oneliner version:

View File

@ -252,7 +252,9 @@ R_API RAnalOp *r_anal_op_hexstr(RAnal *anal, ut64 addr, const char *str) {
int len;
ut8 *buf;
RAnalOp *op = R_NEW0 (RAnalOp);
if (!op) return NULL;
buf = malloc (strlen (str)+1);
if (!buf) return NULL;
len = r_hex_str2bin (str, buf);
r_anal_op (anal, op, addr, buf, len);
return op;

41
sys/find-regression.sh Executable file
View File

@ -0,0 +1,41 @@
#!/bin/sh
NAME=cmd_macros
LAST=`curl -s http://ci.rada.re/job/radare2-regressions/ | \
perl -ne 's,>,\n,g;print' | \
perl -ne 'if (/Last build/) {
$str = $_;
$str=~/\(\#(\d+)\)/;
$str = $1;
print $str;
}'
`
R2R=/tmp/.r2r.txt
R2C=/tmp/.r2c.txt
PREV=""
PR2REV=""
while : ; do
[ ${LAST} -lt 0 ] && break
echo "+ Testing build $LAST..."
curl -s http://ci.rada.re/job/radare2-regressions/${LAST}/consoleText > $R2R
R2B=`grep 'Started by upstream project' $R2R | awk '{print $8 }'`
curl -s http://ci.rada.re/job/radare2/${R2B}/consoleText > $R2C
R2REV=`grep 'Checking out Revision' $R2C | awk '{print $4}'`
echo " - radare2 $R2B = $R2REV"
REV=`grep 'Checking out Revision' $R2R | awk '{print $4}'`
echo " - regression $LAST $REV"
grep ${NAME} $R2R | grep -q XX
if [ $? != 0 ]; then
echo "Passing test found."
echo " + LAST=$LAST..$PLAST"
echo " + RRREV=$REV..$PREV"
echo " + R2REV=$R2REV..$PR2REV"
fi
PREV=$REV
PR2REV=$R2REV
PLAST=$LAST
LAST=$(($LAST-1))
done
rm -f $R2R $R2C