473,473 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Python Comparing Strings Help

2 New Member
Hello... This is my first time posting. One of my co workers told me this is the place to be for help on these kinds of situations. Anyhow this is what I got:

I am trying to make a simple anti phishing script in python. I need help figuring how to look at a simple html source statement such as this (below)and then have the program spit back "bad news" or so forth.

<a href="http://bogus.com" >https://mybank.com</a>


Expand|Select|Wrap|Line Numbers
  1. #! /usr/bin/python
  2. # scan.py
  3. import sys,string,re
  4. f = open(sys.argv[1])
  5. lines = f.readlines()
  6. string = string.join(lines,"")
  7. # I or IGNORECASE for case insensitive, S or DOTALL for . matches \n
  8. phmatch = re.search(r'(secure).*?(phishing)',string,re.IGNORECASE | re.DOTALL)
  9. if phmatch:
  10.   print "Looks like a phishing scam."
  11.   print "Redirection from %s to %s." % (phmatch.group(1),phmatch.group(2))
  12. else:
  13.   print "Looks Ok."
  14.  
Apr 11 '06 #1
0 3619

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Kamilche | last post by:
Man, I've been banging my head against a C program for a while now. I'm embarrassed to admit how long. I really want to use Python, as I mentioned in a prior post, but the speed hit is such that...
3
by: fdsl ysnh | last post by:
--- python-list-request@python.orgдµÀ: > Send Python-list mailing list submissions to > python-list@python.org > > To subscribe or unsubscribe via the World Wide Web, > visit >...
8
by: EP | last post by:
Hi, I'm a bit green in this area and wonder to what extent there may be some existing Python tools (or if I have to scratch my head real hard for an appropriate algorithm... ) I'd hate to build...
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 357 open ( +8) / 3745 closed ( +8) / 4102 total (+16) Bugs : 958 open (+19) / 6657 closed ( +9) / 7615 total (+28) RFE : 251 open...
12
by: Mark Carter | last post by:
Well, I know I'm preaching to the converted - but Python rocks. I've been enchanted by the siren calls of Scheme, Lisp and Forth, but in the end, I find Python much easier. I even tried a little...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.