Sam Trenholme's webpage
This article was posted to the Usenet group alt.hackers in 1995; any technical information is probably outdated.

Mini-shell, hackers, HD disks


Article: 8848 of alt.hackers
From: dxl@fc.hp.com (David Ljung)
Newsgroups: alt.hackers
Subject: Mini-shell, hackers, HD disks
Date: 13 Oct 1995 17:43:59 GMT
Organization: Hewlett-Packard Fort Collins Site
Lines: 121
Approved: dxl@fc.hp.com
Message-ID: 45m8gv$a2d@tadpole.fc.hp.com
NNTP-Posting-Host: hpesdxl.fc.hp.com
X-Newsreader: TIN [version 1.2 PL1.4]
Status: RO

Warren Toomey <wkt@dolphin.cs.adfa.oz.au> wrote:
>ObHack: A challenge with a friend to come up with the smallest
>Unix shell in C.

Well - it doesn't get much smaller than this (without using "system")

I threw in some unnecessary options - a prompt, exit and cd commands and
a 'command not found' message - feel free to take them out if you don't
think it's small enough.  :)

------------------ cut me whip me beat me here ----------------
/* mish - the mini-shell - by David Ljung */
main() {
  char buf[1024], *comm[128];
  int pid,i;

  while(printf("mish] "), gets(buf)) {             /* prompt is
  optional ;) */
    if(!strcmp(buf,"exit")) exit(-1);                    /* optional
    'exit' */

    i=0; while(comm[i]=strtok((i==0?buf:0)," \t")) i++;            /*
    parse */

    if(!strcmp(comm[0],"cd")) { chdir(comm[1]); continue;} /*
    optional 'cd' */

    if(fork()) wait(0);                                     /* parent waits */
    else {                                                   /* child execs */
      execvp(comm[0],comm);
      printf("Command not found\n"); exit(-1);      /* optional
      error check */
    }
  }
}
------------------ cut me whip me beat me here ----------------

Also.............

Anthony Kilna says:
| Please post this garbage to alt.crackers, and keep it out of here.  That
| goes for playing redbox tones into a pay phone.  That is not a hack, that
| is reading a 15 year old document and doing what it says.

Umm  - I can understand your assumption because I've made it myself when I
think I've come across a 'phreaker', but in this case you've got it wrong.
I'd never heard about redboxes or 'phreaking' myself - I just happened along
a pay phone that made those tones particularly loud, and I figured out a way
around their system.  That is a 'hack' no matter which way you define it,
as is dialing a phone by pulsing the hangup clicker.

I've never actually used this to make free phone calls - except the one
time I tested it, but since I'd lost a quarter in that pay phone anyways
I figure I was just getting my money back - so I don't think you can call
it a malicious hack.

However, I think this discussion is really broader than just figuring
out how coin tones work.  I think the real issue here is the definition
of hacker.  See the next line:

| Please, if you
| want to get free calls from a pay phone or break into systems maliciously
| or otherwise, check out alt.2600 or alt.crackers or alt.hackers.malicious
| or something.

Well - I don't want to do anything malicious - but it seems that many
people on this group (as well as the FAQ) have decided that there are
three 'types' of people:

hackers:	nice, gentle people who figure out how to format HD disks
		and install second phone lines	;)
crackers:	evil people who break into systems and do a 'rm -Rf /'
phreakers:	losers who read phone docs and make free phone calls

Okay, I'll agree with you on the 'phreakers' definition  ;)
However, it seems you are missing a whole category of people, the people
that I traditionally called hackers:

hackers:	people who enjoy looking at systems and finding the loopholes
		and corner cases and ways around that system.

I think that is a more correct definition for hacker - and that means that
would include people who come up with new ways to install phone lines as well
as people who figure out (not read up on) tricks to get into some of the
most complex systems of all (computer systems).

I don't see a problem with that.  I don't want to hang out with alt.crackers,
and I don't like to deal with people who maliciously break into things, such
as the cracker who just emailed me looking for 'advice' who I couldn't help.

So are you saying that I have to go hang out with the criminals because
you don't like my ideas here?  *sigh*  That would be a shame.

ObHack:  (inspired by all this talk of HD disks :)
  Many years back I was a computer geek for Arthur Andersen, and we needed
to send some computer docs to another division.  Problem:  The other division
could only read DD 3 1/2" disks.  Anyways, I grabbed a disk and jumped
on a
DOS machine to format the disk as DD.  Well, evidently some version of DOS
(I think it was around 3 or 4) had a bug in it that wouldn't accept the
low-format flag, so every time we tried to format this disk it would keep
getting formatted as HD.  So we searched around for a DD-only drive, but
couldn't find any.  Idea:  find a DD disk and do a disk copy....
Failure - couldn't find any.  Final solution?  Sit down at a Mac and bring
up Apple File Exchange which can do DOS formats :).  Interesting - the
Mac couldn't DOS format the disk, but DOS couldn't?  *grin* ..	Well, I'm
not going to get into a big religious argument here, but I think that says
something about DOS..  ;)

--

Oh - that reminds me - if you short a drive to format disks as HD
regardless of whether they have the HD hole, then you won't be able
to read them in another HD drive without cutting the hole first.

Back in my poor student days I used to do a quick 'HD conversion' by
just clipping off the entire corner of the disk...  the disk would usually
survive for a year or so..  *grin*  Finally I upgraded to a razor blade,
but it sure was slower	:)

Dave

:oooo / oooooooo: ----------= http://www.geom.umn.edu/ljung =------- (__) ---
ooo  /--  --- ooo | David Ljung, dxl@fc.hp.com			     oo )   |
oo  /  / /__/  oo | Hewlett-Packard	  W: (970) 229-2379	moo. |_/\   |
ooo	/     ooo | Computer Architect	  H: (970) 282-9853		    |
:oooo  / ooooooo: --------= Computers don't kill people, people do =---------



Child Child Child Child Child Child Child

Back to index