Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Getting Past Perls Hello World


  • Please log in to reply

#1
sweft

sweft

    Member

  • Member
  • PipPipPip
  • 123 posts
hello

Well, Im here today to find out how to keep a perl script open in command prompt after I run it.
If I wanted it to close I would close the window.

If I was to run this script:
!/usr/bin/perl
use strict; 
use warnings; 
use Net::DNS; 
use NetAddr::IP;

my $ip = new NetAddr::IP (shift) || die "Unable to create NetAddr::IP object\n"; 
my $res = Net::DNS::Resolver->new;
my $num = $ip->num();

for (my $i=0; $i<=$num; ++$i) { 
	my $ip_address = $ip->addr();
	
	if ($ip_address) {
		my $query = $res->search("$ip_address");
		if ($query) {
			foreach my $rr ($query->answer) {
			next unless $rr->type eq "PTR";
			print "$ip_address,",$rr->ptrdname, "\n";
			 }
		} else {
			print "$ip_address,",$res->errorstring,"\n";
		 }
	}
	++$ip;
}

and I run:
perl Reverse-DNS Lookups.pl 00.000.000.000 (ip of website)

it will just close. And I got this source code from: http://geekpit.blogs...everse-dns.html

But I wanted to type it out.

Anyways. Please help!

Thanks in Advanced.
  • 0

Advertisements


#2
stettybet0

stettybet0

    Trusted Tech

  • Technician
  • 2,579 posts
I don't understand... what were you expecting to happen after the script reached its end?

What do you mean by "keep a perl script open"?
  • 0

#3
sweft

sweft

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 123 posts
See the results. I want to see what other domains are on the server. I dont want it to close. Try running it and see what happens. CMD opens and closes.
  • 0

#4
stettybet0

stettybet0

    Trusted Tech

  • Technician
  • 2,579 posts
Please do not PM me for help, keep it all here on the forum.

What operating system are you using?
  • 0

#5
sweft

sweft

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 123 posts
Windows XP
running ActivePerl

Sorry about PMing you.
  • 0

#6
stettybet0

stettybet0

    Trusted Tech

  • Technician
  • 2,579 posts
its okay, the reason that I and many others here discourage PMing is that if someone else has a similar question, they can just look at this topic and get help too.

since you have ActivePerl, you don't need the first line.

also, how did you get the Net::DNS and NetAddr::IP libraries installed on an XP?
  • 0

#7
sweft

sweft

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 123 posts
Ok so I use perl.exe?

And I dont have the Net::DNS and NetAddr::IP libraries installed.

If I want to test an exploit on my site also in perl. It still wont work.

phpnuke-expl.pl 72.232.225.114

It just opens and closes.
  • 0

#8
stettybet0

stettybet0

    Trusted Tech

  • Technician
  • 2,579 posts
oh, I see the problem! are you just double clicking on these things?

Open up Cmd first (Start>Run>cmd>Ok) and then navigate to the directory that your perl file is in. (type "cd [directory path]" and hit enter) then type "[name of perl file]" and hit enter. Now you should see some errors saying that you don't have Net::DNS or NetAddr::IP libraries installed, but at least the window doesn't close right away. :whistling:
  • 0

#9
sweft

sweft

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 123 posts
I will run:

file.pl IP

Than I get
Do you want to predeclare pl? -line 1 pl 72.232.225.114

I put:
Y

In http://www.google.com/codesearch
#!/usr/bin/perl

Seems correct. Cannot get either script to work.
  • 0

#10
stettybet0

stettybet0

    Trusted Tech

  • Technician
  • 2,579 posts
what is "file.pl"? the original code from the first post?

and "#!/usr/bin/perl" would be perfectly correct if you were using a unix system. but you're not, so it's not.

Edited by stettybet0, 24 May 2007 - 07:55 PM.

  • 0

#11
sweft

sweft

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 123 posts
duh I so see it now. haha Im silly. Its the path file to perl.exe
wow.
OK.
Thanks.
  • 0

#12
stettybet0

stettybet0

    Trusted Tech

  • Technician
  • 2,579 posts
yea, you could do "#!C:\[where ever your perl.exe is]", but you don't need to include it with ActivePerl since it should have automatically placed perl.exe in your executable path.

Edited by stettybet0, 24 May 2007 - 08:01 PM.

  • 0

#13
ghostdog74

ghostdog74

    New Member

  • Member
  • Pip
  • 1 posts

hello

Well, Im here today to find out how to keep a perl script open in command prompt after I run it.
If I wanted it to close I would close the window.

you can use
<>;
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP