コード例 #1
0
# -*- coding: utf-8 -*-
"""
Copyright (c) 2014-2015 pocsuite developers (http://seebug.org)
See the file 'docs/COPYING' for copying permission
"""

import os
import subprocess
import time
import sys

from pocsuite.lib.core.revision import getRevisionNumber
from pocsuite import __version__

VERSION = __version__
REVISION = getRevisionNumber()
SITE = "http://seebug.org"
VERSION_STRING = "pocsuite/%s%s" % (
    VERSION, "-%s" % REVISION if REVISION else "-nongit-%s" %
    time.strftime("%Y%m%d", time.gmtime(os.path.getctime(__file__))))

IS_WIN = subprocess.mswindows

PLATFORM = os.name
PYVERSION = sys.version.split()[0]

ISSUES_PAGE = "https://github.com/knownsec/Pocsuite/issues"
GIT_REPOSITORY = "[email protected]:knownsec/Pocsuite.git"
GIT_PAGE = "https://github.com/knownsec/Pocsuite"

LEGAL_DISCLAIMER = "Usage of pocsuite for attacking targets without prior mutual consent is illegal."
コード例 #2
0
ファイル: settings.py プロジェクト: 0x554simon/Pocsuite
"""
Copyright (c) 2014-2015 pocsuite developers (http://seebug.org)
See the file 'docs/COPYING' for copying permission
"""

import os
import subprocess
import time
import sys

from pocsuite.lib.core.revision import getRevisionNumber
from pocsuite import __version__

VERSION = __version__
REVISION = getRevisionNumber()
SITE = "http://seebug.org"
VERSION_STRING = "pocsuite/%s%s" % (VERSION, "-%s" % REVISION if REVISION else "-nongit-%s" % time.strftime("%Y%m%d", time.gmtime(os.path.getctime(__file__))))

IS_WIN = subprocess.mswindows

PLATFORM = os.name
PYVERSION = sys.version.split()[0]

ISSUES_PAGE = "https://github.com/knownsec/Pocsuite/issues"
GIT_REPOSITORY = "[email protected]:knownsec/Pocsuite.git"
GIT_PAGE = "https://github.com/knownsec/Pocsuite"

LEGAL_DISCLAIMER = "Usage of pocsuite for attacking targets without prior mutual consent is illegal."

コード例 #3
0
ファイル: update.py プロジェクト: zerolugithub/Pocsuite
def update():
    if not conf.update:
        return

    success = False

    if not os.path.exists(
            os.path.join(os.path.dirname(paths.POCSUITE_ROOT_PATH), ".git")):
        err_msg = ("not a git repository. Please checkout the 'pocsuite' "
                   "repository from GitHub (e.g. 'git clone --depth 1"
                   "https://github.com/knownsec/Pocsuite.git pocsuite')")
        logger.error(err_msg)
    else:
        info_msg = ("updating pocsuite to the latest development version from "
                    "the GitHub repository")
        logger.info(info_msg)

        debug_msg = "pocsuite will try to update itself using 'git' command"
        logger.debug(debug_msg)

        dataToStdout("\r[%s] [INFO] update in progress " % time.strftime("%X"))

        try:
            # Reference:
            # http://blog.stastnarodina.com/honza-en/spot/python-unicodeencodeerror/
            process = subprocess.Popen("git checkout . && git pull %s HEAD" %
                                       GIT_REPOSITORY,
                                       shell=True,
                                       stdout=subprocess.PIPE,
                                       stderr=subprocess.PIPE,
                                       cwd=paths.POCSUITE_ROOT_PATH.encode(
                                           locale.getpreferredencoding()))
            poll_process(process, True)
            stdout, stderr = process.communicate()
            success = not process.returncode
        except (IOError, OSError) as ex:
            success = False
            stderr = "{}".format(ex)

        if success:
            info_msg = "{0} the latest revision '{1}'".format(
                "already at" if "Already" in stdout else "updated to",
                getRevisionNumber())
            logger.info(info_msg)
        else:
            if "Not a git repository" in stderr:
                err_msg = ("not a valid git repository. Please checkout the "
                           "'pocsuite' repository from GitHub "
                           "(e.g. 'git clone --depth 1 "
                           "https://github.com/knownsec/Pocsuite.git "
                           "pocsuite')")
                logger.error(err_msg)
            else:
                err_msg = "update could not be completed ('{}')".format(
                    re.sub(r"\W+", " ", stderr).strip())
                logger.error(err_msg)

    if not success:
        if IS_WIN:
            info_msg = ("for Windows platform it's recommended to use a Github"
                        "for Windows client for updating purposes "
                        "(http://windows.github.com/) or just download the "
                        "latest snapshot from {}".format(SITE))
        else:
            info_msg = ("for Linux platform it's required to install a "
                        "standard 'git' package (e.g.: "
                        "'sudo apt-get install git')")
        logger.info(info_msg)