May 4, 1999
_______________________________________________________________________
Visit the Happy Hacker site at
http://www.happyhacker.org
_______________________________________________________________________
Happy Hacker Digest, Windows edition
Opening Comments
URLs
Reader Submissions
More Netcat tricks
Foolproof Challenge
Coming Out Of Your Shell
Perl Corner
Editor's Comments
******************************************************************
Opening Comments
Okay, I've been busy at work, so all of the submissions really
help a
lot. I don't have time to test everything...but I put most
of what is
sent to me into the HHD b/c peer review is a cornerstone of the
Open
Source project...having someone put another set of eyes on some
code and
suggesting ways to improve it is how Linux came to be, after
all. If
you have submitted something that hasn't made it into the HHD,
check
your email...I may have sent it back asking you to be more clear
about
something, or explain something a little better. I'm just
looking for
quality submissions...and remember, the long stuff is best submitted
as
a URL...thanks.
******************************************************************
URLs
"Lisa" <Aquarian3@pisces7.freeserve.co.uk>
sends in a URL for a site to
get rid of all of those little annoyances: http://www.annoyances.org
Microsoft's Q174904 (Information about TCP/IP Port Assignments)
http://support.microsoft.com/support/kb/articles/q174/9/04.asp
Microsoft's TCP/IP changes to prevent SYN Flooding (URL wraps)
http://support.microsoft.com/support/ntserver/serviceware/nts40/371kroaa.asp
From "Nick C" <nuklear_bomb@hotmail.com>:
http://www.hackcity.com/features/xoombar.html
******************************************************************
Reader Submissions
From: "FiReWaLL" <indigo@bc.sympatico.ca>
Subj: Text string search
Hi, I'm looking for a program to search for extended ASCII
text strings
(the 256 character DOS set, INCLUDING THE NULL - thats
particularly
what I'm looking for...) in files on a \/\/in95 box ...can anyone
help?
Thanx!
=FiReWaLL=
e-mail: phyrewall@geocities.com
[Editor: I know that the GNU tools from Cygnus includes
a version of
'strings' for Win32, but I haven't tried it on 9x. Hey,
how about if
you use Perl to write your own tool??]
From: "Death Wish" <death2000@webmail.co.za>
Subj: Windows / Registry
Hi there
TD / TeRrIbLe DiGiT here
i like to play around with the windows registry (Win95/98/NT)
A great
site for registry info is the regedit.com site
http://www.regedit.com
For all you registry needs
P.S.: Thank you for all you Pt with the HHD!!! I've
only belong /
Subscribe to you a few weeks ago, and I think you guys
are doing a
great job!!
P.S.S: English is my second lang, please don;t mind
my spelling!!
Thanx
//--------------------------------------
Death Wish
death2000@webmail.co.za
Hack the Planet ! !
[Editor: Thanks for the site...]
From: "N S" <pstar64@hotmail.com>
Subj: Microsoft Article
I enjoy the digest, keep up the good work. I found this
article that
people would be interested in.
http://www.seattleweekly.com/features/9913/features-barcott.shtml
Just some info on Gate's attempt to create an heir.
I hope you haven't
already included this URL...
starNOMFIC
[Editor: We've included it now...]
From: <yruno2@usa.net>
Subj: even more weird out urls
Hi again all you happy hackerz. Thought Id share something
I discovered
a while back after i saw my first dotless ip url and tried
some
experiments. you can also create dotted and dotless ip's
with hex
numerals ;) lets take the ficticious lan ip 192.168.1.222
. convert
each 8-bit address section into hex => 192 = C0 , 168 =
A8, 1=01, 222 =
DE. Hex numerals are represented with an 0x in the front.
so, if there
is a web server at http://192.168.1.222 , you can also
access it via
http://0xC0.0xA8.0x01.0xDE .
Now this is the really cool part. you can do a dotless
hex ip as well.
try the same address above with only one leading 0x and no dots.
http://0xC0A801DE
Whats cool about this is, theoretically you could get numerical
addresses that spell out stuff using the hexadecimal letter-digits
A
through F. I have a famous one in mind im going to investigate
;)
This may not work in all browsers, but it did in ie4 and ns
4.5 for me.
Hmm, maybe octal will work too? binary?
Remember where you saw it first ;) ;)
YRUno2, aka Boomhauer
[Editor: Okay, okay, enough already!! Sheesh...did
that one posting
hit a motherlode or what!!?! I've gotten more email regarding
the
string-to-hex conversion of IP addresses than I have spam
this week!
And here's a cool one, for all of the Howard Stern fans out there...open
'calc' on your Windows box, and go to the Scientific view.
Enter
3132796942, and convert to hex...]
From: "Roboko Neko" <artilect@hotmail.com>
Subj: reader Submission (Win98)
I've got two things to submit. First, Win98 stores startup
and shutdown
splash screens just like w95, as logo.sys(for startup)
logow.sys(
shutting down, and logos.sys (for "ok to turn
off") Simply save a bmp
as one of these names in the dir they came from, copying
them first
somewhere else for backup of course, and you're done.
THe only trouble I have had with this is on some installs,
not being
able to find logo.sys, but I HAVE done it to other W98 boxes,
in fact
the W98 logo.sys works with w95! Makes a good trick on
somebody!
Second, for those with w98 and Personal WEb Server,
if you want to use
the premade asp layouts, but dont like that IE4 logo ad a the
bottom,
Get the gif you want, and save it to the dir c:\iissamples\default\
as ie.gif, saaving the old somewhere else as backup of course.
The
code in the layout.css, with the help of other files, create
the logo
with ie.gif. I chose netscape's animated gif for my page!
Also, if
you want to add java, or just regular html, you can open
c:\wwwroot\default.asp in notepad, and make all the additions
you want.
Thanks,
Artilect
[Editor: I can't test and verify the Win98 startup screen
stuff...but
please...NO MORE EMAIL ABOUT THE WIN98 STARTUP SCREEN!!!
If you have a
method of changing, it fine...post it on a web page and send
me the URL.
For all of you who say they don't have or can't find the files
mentioned
above, I have just one word for you..."attributes".]
From: "Katt ph®eak" <kattphreak@hotmail.com>
Subj: (none)
This is written in response to the following post:
>From: "Max Andersen" <unibomber_98@hotmail.com>
>Hi. I have some questions for you all. If possible, could
you
>publicise it on the hacker's list, so everyone can
read it
>and help me with my queries.
>I have Raising.exe, and Handsoff.exe (security programs)
>installed on our computers which are set up by a LAN, and
>I can not get into Windows as a result of losing my password
>and user name. Also, I can not delete these programs,
becuase
>the computers don't check for a floppy disk when it boots
up,
>therefore, can not use a boot disk to do what I thought would
work.
>Would you please help me with my queries?
>Thank you for your time and support.
Okay this idea may not work but you should give it a whirl...
What you
need to do is set the system to boot a floppy before it
boots the hard
drive. To do this before entering the OS you have to get
into the
system bios. On my desktop, I have to hit the F1 key when
the Gateway
2000 logo pops up as all the nifty little numbers and techno-lingo
fly
by on the screen. On my laptop I have to hit the delete
key when the
Compaq logo appears. If you don't know how to get into
the bios I would
try all the F-Keys(F1, F2...), delete, and all the other
nifty buttons
like that. Eventually, if you're lucky, the bios will open.
Here is
where all the system configurations are located. Things
like timezone,
and what boots first. I'm assuming that those security
programs have
switched your system to boot the hard drive before the
floppy. There
should directions on how to navigate the bios at the bottom
or top of
the screen. Follow those directions until you find the boot options.
Switch the bios to boot the floppy drive before the hard
drive. Exit
the bios, saving your changes as you do. Then shut down your
machine,
pop in your floppy, cross your fingers, and reboot. I hope
this helps
you out, so let me know how it goes.
Hope I helped,
-Kattph®eak- kattphreak@hotmail.com
(yeah, yeah, I know, I know... weird handle, average guy)
[Editor: Read the "Foolproof Challenge" section
below...and instead of
coming up with ways to get around security programs on win9x
(which
seems to be a fairly trivial exercise) why not come up with a
way to
prevent someone from doing so? Oh, yeah, and don't forget
your
password!]
From: mloll@wam.umd.edu
Subj: tcl/tk
> I've had TCL code in here before...just remember that
> this is the Windows HHD...so try to make your code
> specific to the Win32 platform...
You might wanna tell people about VisualTCL, a RAD GUI builder
for
windows, Unix, and MacOS. Let's you build UIs ala visual
basic style
drag-n-drop objects. Generates the tcl/tk code for
the GUI for you.
It is at:
http://www.neuron.com/stewart/vtcl/
[Editor: Great, thanks. One reason for going with
languages like Perl
and TCL over VB is that what you learn on Windows applies directly
to
Unix and Linux...]
From: kreep@iname.com
Subj: A neat batch file
Hi all you happy hackers!
I saw the last guide [or the one before, i dunno] and
saw that batch
file that clears your documents list. I thought it was
quite smart and
so decided to write on that clears your RUN list [i know
i always need
it cleared, and its just a principle]
Now first you need to export the registry file that keeps
the names.
Open up the regedit GUI and export the key :
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion
\Explorer\RunMRU]
to c:\windows\runlist.reg
OR
from dos [c:\] type regedit /e c:\windows\runlist.reg
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion
\Explorer\RunMRU
now edit this reg entry and where it says "a"="explorer.exe"
[or
whatever] change it to "a"="" for all the
letters [b,c,d etc.] and save
it.
Now for the batch file:
------CUT HERE--------
@ECHO OFF
echo Clearing your run history...
cd\windows
regedit runlist.reg
cd\
------CUT HERE--------
Easy huh? now just save it as clearrun.bat [in c:\windows]
and call it
from autoexec.bat by adding the line c:\windows\clearrun.bat
to the end
of autoexec. I know its kinda a simple but i like the idea of
how it
imports a registry entry...
Thanx and keep on hacking!!
kart00n
[PS I'm from south africa! Shout Outz to worldwide hackers!]
kartoon@blader.com
icq #20212752 [ADD ME!]
Peace
[Editor: I haven't tested this one...but it looks good.]
From: "Vladimir Jovanovic" <azak@ptt.yu>
Subj: URL submission
Hi there...
I have made this little program to help people defend
from trojans
binded with SilkRope... It can detect binded programs and
separate
them. (currently only 1.1 version is supported)
url: http://members.tripod.com/~blacklime/razor.arj
Freeware. Enjoy
Zak McKracken... from BadGuyLand
If you like it click on the banner on
http://members.tripod.com/~blacklime
:)))
[Editor: I hope the .arj extension doesn't upset anyone.
If it does,
and you don't know what to do with it, email the author...]
From: "Death Wish" <death2000@webmail.co.za>
Hi there, i see that you have been getting lots og E-mail
about how to
change the bootup screens for Win 9x, well I have one for
you can
change the NT bootup screen.
Well, ltes get started, the old boring bootupscreen
for server id the "lanma256.BMP" file that is
located in the Winnt
directory. Well, to change it just open the "lanma256.BMP"
file in
paint and change it to whatever you want it.
Ok, Lock off and log in again, see, there is your pic that
you wanted,
but now you have to old boring blue type of screen. Well,
to chage that
all that you have to do is open a new file in paint and
chage the
setting of the page (Open paint, goto Image, attributes
) and set it to
whatever your screen size is (eg 800 x 600, etc), now open
the image
that you want to have on you bootup screen with paint,
goto "edit" and
select the "select all" option. Right click on it and
copy it. Goto the
first paint program that you have open and select "edit",
next click on
"Paste". The pic will be in the left hand corner,
Move it to the center
of the page. Select the "fill with color" chose
you color (eg. black)
and fill the background with it. and save it as "lanma256.BMP"
in your
Winnt directory. Log off and log on again, ahhh, the blue is
gone and
it's black. Say you have a pic that is 800 x 600 and your
screen is set
to 800 x 600 then you just save it as "lanma256.BMP"
in your winnt
directory and it will be full screen. I'm not sure, but the Workstation
has the same file, if it doesn't then just look for the *256.BMP
file,
it will be there
Regards
TD / TeRrIbLe DiGiT
//--------------------------------------\\
******************************************************************
More Netcat tricks
From: lazerus001@juno.com
Hi, I don't know if this will get printed, but its worth a
shot. I have
two more NetCat tricks. First is how to use it as an E-Mail
sender.
First create a DOS batch file containing this:
<system>= your smtp daimon
[Editor: Spell it however you like, but I think the
author
meant "daemon".]
begin mail.bat
-----------------------
nc -v <system> 25 < mail.txt
-----------------------
end mail.bat
and mail.txt should contain smtp commands and your message.
example mail.txt
----------
HELO smtp system
MAIL FROM:yourmail@domain
RCPT TO:resiever@domain
DATA
Content-Type:text/plain
X-Mailer:NetCat E-Mail
Trick by Fatal Error
Subject:NetCat
Mesage here.
.
QUIT
----------
My second trick is to use NetCat as a defence program with
help from my
NCA program. (NetCat Attack, an ASCII flooder I wrote in
QuickBASIC.)
By simply using the anti-portscanner/sniffer trick along
with NCA you
have a simple BOOBY-TRAP! Using the following batch file:
trap.bat
-------------
nc -v -L -d localhost -p 12345 > intrudres.txt
nc -L -d localhost -p 12345 -t -e nca.exe
nc -v -L -d localhost -p 31337 > intrudres.txt
nc -L -d localhost -p 31337 -t -e nca.exe
-------------
you've installed our boobytraps. Now when anyone portscans
your computer
they'll both get logged and find two "possible" backdoors
;). Now if
they were to telnet to those ports they will be logged
again and
they'er telnet screen will be flooded with ascii chars.
Also you have
enough to get them kicked off their isp :). I'm not 100%
sure, but if
they connect to either port with NetBus or BO their clients
should
crash. I highly doubt they were coded to handle a sudden
flood of ASCII
code. If you can test that let me know the results. I bet
they'll be
interesting.
[Editor: Now, this is what I like to see. I guess
we'll all have to
email lazerus for a copy of his NCA.exe...or write our
own. I like how
lazerus has brought together several concepts...using netcat,
defense
of your system, etc. Great job, lazerus!!]
******************************************************************
Foolproof Challenge
Recently I received a couple of emails regarding how to get
around or
shut down the Foolproof program; most notably, those emails were
from
"Freefall" <frfalljd@swbell.net> and jerry kulinger
<raz_e_r@yahoo.com>.
Interesting approaches, to say the least, neither of which
I could test
out.
However, here's a challenge for all of you who have been
frustrated by
Foolproof, and found a way around it. Come up with a way
to make
Foolproof...well...foolproof. Make it as close to impossible,
or at
least exceedingly difficult, to get around or shut down FoolProof.
Here's my reasoning for the challenge. Obviously, if
someone takes the
time and effort to purchase and install the product, it's
there for a
reason. So some really bright users feel restricted by
it, and devise
methods to get around it.
But is that what 'hacking' is all about? No...so
let's take it a step
further. After all, you're not just 'crackers' are you?
Let's tell the
sysadmin what you did and how you were able to do so, and then
offer to
set things up so that it won't happen again.
You'll probably need the user manuals that came with the program
as well
as a test system on the network to work with. These shouldn't
be a
problem.
The goals of this challenge are to secure the box in such
a way that
it's exceedingly difficult (ie, a "non-trivial exercise")
to circumvent
Foolproof again, AND at the same time, leave the system in a
usable
state...users should still be able to access the system and use
it for
it's original intent.
There are no limitations to this challenge. Given the
above stated
goals, 'securing' the box in a block of concrete and sinking
it to the
bottom of the ocean is definitely out! The system must
still be usable.
Use whatever you like...another, additional product (something
that will
require market research), System Policies from the login
server (if one
is used), etc.
Now for the Open Source part of the challenge...you must post
your
method, documented in detail, on a web page, and send me the
URL. I
will add the URLs to the HHD, and other readers taking
part in the
challenge can verify that your system works, or find a
way to
circumvent it. Remember, gentle readers, this is
how Unix was
developed over the years...open source and peer review...
So...want to take the challenge?
******************************************************************
Coming Out Of Your Shell
"Have you ever had a dream, Neo, that you were so sure
was real, that
you were unable to wake from that dream, how would you be
able to tell
the real world from the dream worl......"
Oops.
Good movie, see it anyway.
Hello Happy Hacker!
(You were right, my sysadmin had my netstat "turned off").
Ever want an open source shell, but the functioality *coughGamescough*
in Windows? :)
http://www.litestep.net/builds/ls-0_24_4src.zip
There is your source....
http://www.litestep.net
And there is your new Windows Shell! =)
http://members.xoom.com/tiberianson/mybox.htm <--
My computer
And there is what it looks like! =)
LiteStep is based on XWindows, and is perfect for those of us
who like
the way Windows runs our applications, but hate the jludge
interface or
just feel like getting in there and beating out some code
once and
awhile. It's also a helluva lot easier to set up
than X, and never
traps youin 4 colour "pseudocolour" mode (*CoughHelpMeCough*).
And
doesn't require SuperProbe(which also hard locks my linux
box). I
generally like it, it's fairly stable (fairly, when you
crash with this
thing, you crash hard, but it's more stable than windows
seems to be,
IMOHO), and turns heads at school on my laptop. ;)
Everything is programmable from a STEP.RC file (XF86Config, anyone?),
including the look and icons inside the wharf there on the side.
For
those who are courious, yes, it supports transparancy effects
al la
eterm (or Enlightenment, for those who wonder.....), and also
supports
Linux themes (though they seem to be a bit unstable in my
experiance,
and require some re-writing before they want to work).
If your REALLY into customizing this stuff, grab a copy of
WindowsBlinds or eFX, and get the nifty rollup bars like I have.
(The
rollup bars in the screenshot are NOT a result of LiteStep,
they are a
result of WindowsBlinds).
I like www.annoyances.org/win98/ but they missed one little thing.
How
to change your computer from saying, "Starting Windows 98"
to "Starting
TiberianSons 31337 Box " (or whatever, mine never actually
displays
this). What you do here is make a boot disk (because
if you do this on
your hard drive or assume that my words are infallable
your going to
regret this really quick), make the boot disk bootable
(it is a boot
disk, after all). Set IO.SYS off of READ ONLY (you can
leave it
hidden), then use DOS EDIT on IO.SYS. About 25% down (line
394), it
will give you the generic windows 9* blah blah blah. Looks
like this:
<<snip>>
$ Starting Windows 98...
$ Windows 98 is now starting your MS-DOS-based program.
$ Windows 98 is now restarting...
$ Press Esc not to cancel MS-DOS mode and restart Windows 98...
<<snip>>
Bingo. That's what we want to see. Now you can change
all that stuff
and make it look fairly cool. DO NOT use control codes
("'leet
script"). If you wanna play with punctuation, do so
on your boot disk.
In fact, do the whole project on your boot disk until the
boot disk
boots! Then copy the boot disks IO.SYS over your
own IO.SYS. Most of
the time IO.SYS is located in C:\ (I sure hope it is! <grin>).
Anyhow, I've been doing this for months, I never knew anyone
had any
interest in making Windows look cool or recompiling their windows
shells. :) Oh well, any questions ya can just e-mail
me. :)
Thank you RavenBlack for showing www.annoyances.org to us.
:) The
last thing you want to tweak out is your startup-shutdown screens,
so
that can be done here:
http://www.annoyances.org/cgi-bin/ce-showtopic/004_011
(notice the annoyances.org).
Anyhow, I hope ya all enjoy this, and remember that replacing
your
windows shell and editing IO.SYS carries heavy "You Can
Shoot Your Self
In The Foot" warnings. The windows shell might make
some things crash
unexpectedly (or, my main complain, FIND seems to not work at
all in
Win98 with LiteStep, and neither does AOLIM'er, accoring to my
younger
brother). It's also a bit of work to get those icons into
the wharf.
As for IO.SYS, PLEASE remember to practice this on a boot disk,
OK? :)
Laters,
TiberianSon
2611542
Tiberian@ICDC.COM
*APPENDATION*
*APPENDATION*
*APPENDATION*
*APPENDATION*
REMEMBER TO SET IO.SYS BACK TO READ ONLY AND HIDDEN WHEN YOU
ARE DONE
EDITING OR IT WILL NOT WORK.
Also, I use attrib for this, if it works with Win9* attribute
changer
in the properties popup, yipee, but I know it works with
tried and true
attrib.
<<End>>
Thanx man,
TiberianSon
******************************************************************
Perl Corner
From: grind@pacbell.net
Well just thought I'd contribute and send in a fairly simple
perl
script, after months of getting free scripts, I decided to write
my own
and this was my first one. Took me a while to figuring out
how to parse
it right, so anywho, here it is:
-----------------------------------------------------------------
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hey man! Just logging your ip address,
$ENV{'REMOTE_ADDR'}
connecting on port $ENV{'SERVER_PORT'}, this info will
come in handy
*evil grin*<br>";
print "Oh I see your using $ENV{'HTTP_USER_AGENT'} for
net surfing,
not bad<br>";
$s = $ENV{'HTTP_USER_AGENT'};
($m) = ($s =~ /W(.*)n/);
if ($m eq 'i'){
print "You should use Unix instead of windows,
don't you know
anything? *L*";
}
$h = $ENV{'REMOTE_ADDR'};
($i) = ($h =~ /127(.*)1/);
if ($i eq '.0.0.'){
print "<br>Hey Jeff!";
}
------------------------------------------------------------------
(Note that when I say prints out, I mean it'll put the
words on the
screen *L*, didn't want to confuse anyone) So here is how it
works, it
calls perl from /usr/bin/perl to run the script (which
of course is
needed), than says it will use html to print out the
info. Next it
prints the nifty little text "Hey man! Just logging
your ip address,
$ENV{'REMOTE_ADDR'} connecting on port
$ENV{'SERVER_PORT'}, this info will come in handy *evil grin*<br>"
this
prints out your ip address (where it says $ENV{'REMOTE_ADDR'},
it'll
put your ip address ) and the port on the server you used
to connect on
(where it says $ENV{'SERVER_PORT'}, it'll put the port
number), and of
course, it really doesn't log your ip. BTW, $ENV stands for enviroment
variable, you can do some pretty cool stuff with this guy,
at the end,
I'll give you all a url which lists all of them Now the
next part is a
little bit more complicated, but its easy to get.
So lets look at the
next couple of lines:
-----
print "Oh I see your using $ENV{'HTTP_USER_AGENT'} for
net surfing,
not bad<br>";
$s = $ENV{'HTTP_USER_AGENT'};
($m) = ($s =~ /W(.*)n/);
if ($m eq 'i'){
print "You should use Unix instead of windows,
don't you know
anything? *L*";
-----
This prints out "Oh I see your using $ENV{'HTTP_USER_AGENT'}
for net
surfing, not bad <br>" pretty simple, and the
$ENV{'HTTP_USER_AGENT'}
prints out your browser and system. The next line is what
took me a bit
to get, it's saying:
The variable, $s, equals $ENV{'HTTP_USER_AGENT'}
The variable, $m, looks at the variable $s to see if the operating
system has a "W" at the beginning and a "n"
at the end now if $m equals
i (the letter in between) it will print out "You should
use Unix instead
of windows, don't you know anything? *L*"
-----
$h = $ENV{'REMOTE_ADDR'};
($i) = ($h =~ /127(.*)1/);
if ($i eq '.0.0.'){
print "<br>Hey Jeff!";
----
Now the next part works the same way, so here is how it works:
When I
access localhost (my webpage) and go to main.html (where
the script is
implemented) it sees if my ip address equals 127 at the
beginning and
1 at the end now it sees that if my ip address has a .0.0.
in the
middle, print out "<br>Hey Jeff!" (which
is my name)
Well thetas my contribution to the list, if you want to learn
perl go
to, http://www.cgi-resources.com and download some scripts
and split
them apart (as I've done here) and see to understand them.
Its a simple
concept, just hard to know how to put the "verbs"
in there. To learn
the environment variables, go to, http://www.cgi-
resources.com/Documentation/Environment_Variables/, and if you
have some
spare time, go to my site, http://degrind.dhs.org (has a link
to the
happyhacker *L*)
Jeff
[Editor: Thanks, Jeff, for the CGI submission.
You can write CGI in
Perl, or Python, VB, etc. To learn more about writing CGI,
check out
the site Jeff mentioned at http://www.cgi- resources.com. ]
Note: If you are interested in more info about CGI programming,
look at
the CGI.pm file in your ActivePerl install. Books are available
online
from http://www.mcp.com (create your own personal bookshelf)
and
http://www.ora.com. If you have access to an NT web server,
and would
rather use ASP, there is a Win32::ASP module available (I haven't
played
with it yet...)...
Okay, now here's some Perl stuff you all might be interested
in...
From: "dave andrews" <dave31_5@hotmail.com>
Subj: Perl
Here is a little script that the administrators reading may
like. It
allows you to use perl in an interactive format. Just type
in the perl
command, press enter and it will be done. Then when you
have finished
type exit to end the program.
do {
print("> ");
chop($_ = <>);
eval($_);
warn() if $@;
} while ($_ ne "exit");
Why would you want to do this? Say for example you have lots
of batch
files which you use to perform lots of different tasks,
with a little
extra work to this script you can create your own perl
command line
interface, which could include all of the tasks you normally
handle but
in perl form. Then just add them to this template program
with a
command name and you can then just type in that name and
it will be
done for you. Just keep adding tasks in separate subs
and you can
gradually create your own administrative command line interface
for
perl.
This example interface includes one task that dose some backing
up when
the do#backup command is entered. All custom commands should
have do#
as the first part of the command, this separates these
commands from
proper perl commands.
sub backItUp {
`backup /user/*`;
`delete /user/*.bak`
}
sub help {
print("do#backup will perform the nightly
backup\n");
print("help will display this message.\n\n");
}
do {
print("> ");
chop($_ = <>);
if (/^do#/) {
backItUp() if /backup/;
}
elsif (/^\s*help/) {
help();
}
else {
eval($_);
warn() if $@;
}
} while ($_ ne "exit");
Just enter help to see instructions on use and exit to leave
the
program. Of course any users would need to insert commands
that they
would want executed, the one included is just an example.
Hope this is useful to someone.
Keep up the good work
Dave Andrews (FatherTed)
******************************************************************
Editor's Comments:
Couple of notes:
- I am not Carolyn, nor am I the editor of the Unix digest.
I am not
even in the same state as Carolyn.
- I will not tell you how to hack into a box.
- It's really easy for me to answer qu
_______________________________________________________________________
Unsubscribe
with message "unsubscribe
hh."
This is a list devoted to *legal* hacking! If you plan to
use any
information in this Digest or at our Web site to commit crime,
go away!
Foo on you! Don't email us bragging about any crimes you may
have
committed. We mean it.
For Windows questions, email keydet89@yahoo.com.
For Unix questions, contact unixeditor@cmeinel.com.
For Macs, email Strider <s.corinth@iname.com>
Happy Hacker staff: Unix editor, <unixeditor@cmeinel.com>;
Windows editor, Keydet89 <editor@cmeinel.com>; Hacker
Wargame
Director, Vincent Larsen <vincent@sage-inc.com>; Clown
Princess: Carolyn Meinel <>
Happy Hacker is a 501 (c) (3) tax deductible organization
in the United States operating under Shepherd's Fold Ministries.