[ale] Need help with a Python Script

Richard Bronosky Richard at Bronosky.com
Thu Nov 17 22:29:12 EST 2011


Chuck,
You really need to experiment at the REPL. That is the main reason for
choosing a scripting language like python. I suggest installing
ipython (or bpython) so that you get tab completion. The you would do
this:
$ ipython
Python 2.4.3 (#1, Nov 11 2010, 13:30:19)
Type "copyright", "credits" or "license" for more information.

IPython 0.8.4 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import os

In [2]: os.get
os.getcwd      os.getegid     os.geteuid     os.getgroups
os.getlogin    os.getpgrp     os.getppid     os.getuid
os.getcwdu     os.getenv      os.getgid      os.getloadavg  os.getpgid
    os.getpid      os.getsid

In [2]: os.gete
os.getegid  os.getenv   os.geteuid

In [2]: os.getenv('HOSTNAME')
Out[2]: 'vm1.example.com'


However, os.getenv can only get was is available as environment
variables. You can check those at the terminal with the env command.

On Thu, Nov 17, 2011 at 10:23 PM, Stephen Haywood
<stephen at averagesecurityguy.info> wrote:
> What version of Python are you using?
>
>
> --
> Stephen Haywood
> Information Security Consultant
> CISSP, GPEN, OSCP
> T: @averagesecguy
> W: averagesecurityguy.info
>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>
>



-- 
.!# RichardBronosky #!.


More information about the Ale mailing list