ptreport

Differences between revisions 6 and 12 (spanning 6 versions)
Revision 6 as of 2008-02-19 01:32:58
Size: 4405
Editor: host185-223-dynamic
Comment:
Revision 12 as of 2008-08-06 16:40:37
Size: 178
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
[[Include(UbuntuPentest/Header)]] <<Include(UbuntuPentest/Header)>>
Line 3: Line 3:
'''anateater''' V 0.1 alpha
[http://thc.emanuele-gentili.com/~emgent/anateater/anteater.py anateater.py]
Please see and use:
https://code.edge.launchpad.net/ubuntu-whitehat-project/
Line 7: Line 7:
{{{
#!/usr/bin/env python

# anteater V 0.1 Alpha
# (C) 2008 Ubuntu Pentest, Emanuele Gentili
# Authors
# Emanuele Gentili <emgent@emanuele-gentili.com>
# Giorgio Carlo Gigli Tos <gionnyboss@gmail.com>
# GPLv2, see /usr/share/common-licenses/GPL

import sys
import os
from stat import *
import re

class Application():
 NAME = "anteater.py"
 VERSION = 0.1
 AUTHORS = \
   "Emanuele Gentili (emgent)\n" \
   + "Giorgio Carlo Gili Tos (GionnyBoss)"
 
 LICENSE = "This is free software. You may redistribute copies of it under the terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.\n" \
   + "There is NO WARRANTY, to the extent permitted by law."
 
 cocFilename = "coc.txt"
 editor = "nano"


 def __init__(self):

  self.__getOptions()

  # Displaying code of conduct
  os.system("more " + self.cocFilename)
  
  while True:
   reply = self.__getLine("Do you accept Ubuntu Code of Conduct? [y,n] ")
   if re.match("^\s*y\s*$", reply, re.IGNORECASE):
    break
   elif re.match("^\s*n\s*$", reply, re.IGNORECASE):
    sys.exit("You did not accept Ubuntu Code of Conduct.\nExiting application...")

  self.start()
   
 # Get command line options
 def __getOptions(self):
  
  from optparse import OptionParser
  
  usage = self.NAME + " [OPTION]..."
  version = self.NAME + " " + str(self.VERSION) + "\n" + self.LICENSE + "\n\nWritten by " + self.AUTHORS
  description = "Application description"
  
  parser = OptionParser(usage=usage, version=version, description=description)
  parser.add_option("-e", "--editor", action="store", type="string", default="nano", help="command of the editor to use to edit your bug report [default: %default]", metavar="EDITOR")
  (options, args) = parser.parse_args()
  
  self.editor = options.editor
  # Checking if editor exists in path
  pathDirs = os.environ['PATH'].split(":")

  editorValid = False
  for dir in pathDirs:
   file = os.path.join(dir, self.editor)
   if os.path.isfile(file):
    mode = os.stat(file)[ST_MODE]
    # Checking if file is executable to Others
    # TODO - Think if there is a better way to do this.
    if (S_IMODE(mode) & S_IXOTH) == S_IXOTH:
     editorValid = True
     break

  if not editorValid:
   sys.exit(self.NAME + ": specified editor `" + self.editor + "' is not in your path")

 def __getLine(self, text):
  
  try:
   line = raw_input(text)
  except (EOFError, KeyboardInterrupt):
   print ""
   self.quit("Aborted by user")
  return line

 def start(self):
  launchpadID = self.__getLine("Please insert your Launchpad ID: ")
  ip = self.__getLine("Please insert your current IP: ")
  platformName = self.__getLine("Please, enter the name of the platform where you make pt: ")
  
  reportFilename = platformName + "-report.txt"

  # Opening coc file for reading and report file for writing
  cockFile = open(self.cocFilename, 'r')
  reportFile = open(reportFilename, 'w')
  # Writing coc file content to reportFile
  reportFile.write(cockFile.read())
  # Closing coc file
  cockFile.close()
  # Writing report intestation
  reportFile.write("Ubuntu Pentest Evangelist Informations:\n" \
    + "USER: https://edge.launchpad.net/~" + launchpadID + "\n" \
    + "IP: " + ip + "\n" \
    + "* Starting Report for " + platformName + ":\n")
  # Closing report file
  reportFile.close()

  os.system(self.editor + " " + reportFilename)

  # gpg sign
  os.system("gpg --clearsign " + platformName + "-report.txt")

  # Deleting report file and renaming signed report file to report file name
  try:
   os.remove(reportFilename)
  except OSError:
   sys.exit(self.NAME + ": cannot remove `" + reportFilename + "'")
  try:
   os.rename(reportFilename + ".asc", reportFilename)
  except OSError:
   sys.exit(self.NAME + ": cannot rename file `" + reportFilename + ".asc' to `" + reportFilename + "'")

  # launchpd sending bug ... (we will add python-launchpad-bugs script for automated open bugs)

 def quit(self, msg):
  sys.exit(msg)

# ------------------------------------------------------------------------------
# Application START

if __name__ == "__main__":
 application = Application()
}}}

= Template report =
----
'''Sub-pages :''' <<Navigation(children,1)>>
----

Home

Members

Auditing result

FAQ

Contacts

NEXT Ubuntu Pentest MEETING:
Not Avaiable (details)

NEXT Security Team Meeting:

Include: Nothing found for "* '''When''':"!

Please see and use: https://code.edge.launchpad.net/ubuntu-whitehat-project/


Sub-pages :


UbuntuPentest/ptreport (last edited 2008-08-06 16:40:37 by localhost)