Skip to content

Commit

Permalink
just try to extract a function name from sql comments in anon mode
Browse files Browse the repository at this point in the history
  • Loading branch information
asher committed May 24, 2012
1 parent 4aeec16 commit 1966506
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 24 deletions.
15 changes: 3 additions & 12 deletions dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,9 @@
$rows = array();
while ($row = mysql_fetch_assoc($result)) {
if ($conf['anon']) {
if (preg_match('@/\*.*\*/@', $row['sample'], $matches)) {
if (preg_match('@ 127.0.0.1 \*/@', $matches[0])) {
$extra = $matches[0];
} elseif (preg_match('@ \d+\.\d+\.\d+\.\d+ @', $matches[0])) {
$extra = preg_replace('@\d+\.\d+\.\d+\.\d+@', 'External_IP', $matches[0]);
} elseif (preg_match('@ \S+ \*/@', $matches[0])) {
$extra = preg_replace('@ \S+ \*/@', ' User */', $matches[0]);
}
else {
$extra = $matches[0];
}
$row['sample'] = $extra . ' ' . $row['fingerprint'];
if (preg_match('@/\* (\S+)(::\S+)?.*\*/@', $row['sample'], $matches)) {
$c = ($matches[2]) ? $matches[1] . $matches[2] : $matches[1];
$row['sample'] = '/* ' . $c . ' */ ' . $row['fingerprint'];
} else {
$row['sample'] = $row['fingerprint'];
}
Expand Down
15 changes: 3 additions & 12 deletions more.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,9 @@
$rows = array();
while ($row = mysql_fetch_assoc($result)) {
if ($conf['anon']) {
if (preg_match('@/\*.*\*/@', $row['sample'], $matches)) {
if (preg_match('@ 127.0.0.1 \*/@', $matches[0])) {
$extra = $matches[0];
} elseif (preg_match('@ \d+\.\d+\.\d+\.\d+ @', $matches[0])) {
$extra = preg_replace('@\d+\.\d+\.\d+\.\d+@', 'External_IP', $matches[0]);
} elseif (preg_match('@ \S+ \*/@', $matches[0])) {
$extra = preg_replace('@ \S+ \*/@', ' User */', $matches[0]);
}
else {
$extra = $matches[0];
}
$row['sample'] = $extra . ' ' . $row['fingerprint'];
if (preg_match('@/\* (\S+)(::\S+)?.*\*/@', $row['sample'], $matches)) {
$c = ($matches[2]) ? $matches[1] . $matches[2] : $matches[1];
$row['sample'] = '/* ' . $c . ' */ ' . $row['fingerprint'];
} else {
$row['sample'] = $row['fingerprint'];
}
Expand Down

0 comments on commit 1966506

Please sign in to comment.