Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2007

Tip: Looking for answers? Try searching our database.

help me with a program

Thread view: 
boris - 26 Jul 2007 15:09 GMT
How to create a java program to validate date and email id entered.I
think an algorithm will also do just fine. I am still learning java
please help.
Daniel Pitts - 26 Jul 2007 15:51 GMT
> How to create a java program to validate date and email id entered.I
> think an algorithm will also do just fine. I am still learning java
> please help.

First, you should give a better subject line when posting here.  "Help
with Date and Email validation" would have been better.  And simply
"Date and Email validation" would have been even better.

Back to your question:
regex (java.util.Pattern) to "help" validate these, but in general, e-
mail addresses can only be validated by sending a message with a
"secret" to that address, and having the recipient inform your system
of the secret.

I once spent some time creating a regex that validates the syntax of
an e-mail address, but it really was pointless after all.

As for the date, you could also probably use SimpleDateFormat class to
try to parse the date.
Roedy Green - 26 Jul 2007 16:19 GMT
>How to create a java program to validate date and email id entered.I
>think an algorithm will also do just fine. I am still learning java
>please help.

for a very elaborate algorithm to validate email address, look at the
code posted at http://mindprod.com/products1.html#BULK

For code to parse a date, and in the process validate it, see
http://mindprod.com/jgloss/calendar.html
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Twisted - 27 Jul 2007 11:44 GMT
On Jul 26, 11:19 am, Roedy Green <see_webs...@mindprod.com.invalid>
wrote:
> for a very elaborate algorithm to validate email address, look at the
> code posted athttp://mindprod.com/products1.html#BULK

YOUR WEB SERVER HAS BEEN HACKED. TAKE IT OFFLINE AND FIX THE SECURITY
HOLE AND THE ALTERED CONTENT ASAP.

This is not a drill. The URL above, which I trust you intended to be
simply informative, instead completely wedges Firefox and probably is
trying to do something that would have much nastier consequences in
the presence of Internet Exploder. This indicates that your webhost
was compromised and the file contents altered (probably adding a 1x1
iframe linking to an evil script hosted somewhere else entirely;
that's what these jokers usually do) to try to exploit browser bugs
and do something malicious like install spyware on visitors'
computers.

If you can patch the server's security yourself do so. If not, change
hosting provider to someone other than Dreamhost (a guess but likely
correct; there's been a lot of discussion in certain circles of their
recent repeated major security breaches, adding exactly these sorts of
malicious but subtle changes to honest web pages) and from your
current provider (if different). Then fix or restore all the altered
files (restoring every single file from a known-good backup is safest
but may lose recent changes) and put the site back on the air.

If you do change host, do be sure to tell them exactly, in
excruciating detail, why you are doing so as well. Maybe they'll
eventually shape up if they get enough such negative feedback. If you
host yourself and can't find out how the attack was done and how to
prevent it happening again, you probably want to change server
software (if it's IIS then for Christ's sake change it NOW!) and you
may want to change to professional hosting that knows what they're
doing security-wise (i.e. not Dreamhost!) ...

I hope this has been caught and gets fixed before anyone has genuinely
been burned. Otherwise your excellent Java site's reputation is
probably irretrievably in the toilet. :(
Lew - 27 Jul 2007 12:48 GMT
> On Jul 26, 11:19 am, Roedy Green <see_webs...@mindprod.com.invalid>
> wrote:
[quoted text clipped - 13 lines]
> and do something malicious like install spyware on visitors'
> computers.

Works fine for me.  Firefox, even.  No difficulties whatsoever.

Signature

Lew

Twisted - 27 Jul 2007 13:45 GMT
> Works fine for me.  Firefox, even.  No difficulties whatsoever.

So he fixed it in at most an hour -- good. Still alarming that this
happened. I've run into malicious iframes myself once or twice before
but without such a drastic consequence. This time, click a link and
boom! Dead browser, ctrl-alt-del end-task, and God knows what the
buggy page content was trying to do probably under the faulty
assumption that the user-agent was IE.
Christopher Benson-Manica - 27 Jul 2007 22:02 GMT
> > On Jul 26, 11:19 am, Roedy Green <see_webs...@mindprod.com.invalid>
> > wrote:
> >> http://mindprod.com/products1.html#BULK

> > This is not a drill. The URL above, which I trust you intended to be
> > simply informative, instead completely wedges Firefox

What, just because a page toasts Firefox it's indicative of some kind
of security flaw?  *shrug* Firefox may not be M$ crap, but it's got
bugs.  If it's tripping your antivirus, of course, that's a different
story.  Looking at the page source, however, I see no <iframe> tags at
all, nor any particularly unsavory-looking script, nor does Firefox so
much as blink.  I would not be so quick to don the tin-foil hat in the
absence of more convincing evidence.

Signature

 C. Benson Manica    | I appreciate all corrections, polite or otherwise.
cbmanica(at)gmail.com |
----------------------| I do not currently read any posts posted through
  sdf.lonestar.org   | Google groups, due to rampant unchecked spam.

Twisted - 28 Jul 2007 03:27 GMT
On Jul 27, 5:02 pm, Christopher Benson-Manica
<at...@faeroes.freeshell.org> wrote:
> > > On Jul 26, 11:19 am, Roedy Green <see_webs...@mindprod.com.invalid>
> > > wrote:
[quoted text clipped - 4 lines]
> What, just because a page toasts Firefox it's indicative of some kind
> of security flaw?

That's a denial-of-service attack, even assuming it wasn't an attempt
at something worse.

> *shrug* Firefox may not be M$ crap, but it's got bugs.

Evidently. And trying to exploit them, as the defaced site code
evidently did, is still an attack even if they aren't M$ bugs.

Most likely the evil script someone snuck in there tried to do
something that would have compromised a sufficiently out of date IE
and, being malformed in some way in order to exploit that bug, also
tripped a less severe bug in Firefox.

> Looking at the page source, however, I see no <iframe> tags at
> all, nor any particularly unsavory-looking script, nor does Firefox so
> much as blink.

That's because it was fixed (indeed, within 1 hour of my reporting
it). Nonetheless that page did crash Firefox and no longer does,
meaning something on that page changed. I find it highly unlikely that
someone of Roedy's reputation constructed the page to crash Firefox in
the first place, which suggests it actually changed to do so and then
changed BACK. The first change would be a defacement perpetrated by
someone else not authorized by Roedy to alter his Web site's code and
the second would be Roedy undoing the damage after receiving a heads-
up.

Unless you have an alternative theory to explain it? (Other than that
I'm simply making this up, a theory that I know to be false even if I
can't prove it to anyone else -- since the browser hung as soon as it
tried to load the page I had no way of getting a look at the page
source until it was fixed, whereupon obviously there'd be nothing
relevant to see in said source anymore, so I don't have and could
never have had a copy of the source with the malicious edit still
intact. And I was sure as *hell* not going to try to access it in IE
to get a look at the source! Maybe I should have tried viewing it in
FF with JS disabled but it didn't occur to me until it was too late
and the page had been fixed.)
RedGrittyBrick - 28 Jul 2007 12:54 GMT
> since the browser hung as soon as it tried to load the page I had no
> way of getting a look at the page source until it was fixed,

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;

public class Wget {
    public static void main(String[] args) throws Exception {
        URL url = new URL("http://mindprod.com/products1.html#BULK");
        URLConnection connection = url.openConnection();
        HttpURLConnection httpConn = (HttpURLConnection) connection;
        InputStreamReader isr =
            new InputStreamReader(httpConn.getInputStream());
        BufferedReader in = new BufferedReader(isr);
        String inputLine;
        while ((inputLine = in.readLine()) != null)
            System.out.println(inputLine);
        in.close();
    }
}
blmblm@myrealbox.com - 04 Aug 2007 10:18 GMT
> > On Jul 26, 11:19 am, Roedy Green <see_webs...@mindprod.com.invalid>
> > wrote:
[quoted text clipped - 15 lines]
>
> Works fine for me.  Firefox, even.  No difficulties whatsoever.

Was there ever any public confirmation that the above-mentioned
Web page was maliciously changed, and then fixed?  As the revised
subject line indicates, I'm mildly curious ....

Signature

B. L. Massingill
ObDisclaimer:  I don't speak for my employers; they return the favor.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.