id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
37,200 | ResultActionTest.py | coala_coala/tests/results/result_actions/ResultActionTest.py | import unittest
from coalib.results.Result import Result
from coalib.results.result_actions.ResultAction import ResultAction
from coalib.settings.Section import Section
class ResultActionTest(unittest.TestCase):
def test_api(self):
uut = ResultAction()
result = Result('', '')
self.asser... | 1,667 | Python | .py | 37 | 29.27027 | 75 | 0.519729 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,201 | GeneratePatchesActionTest.py | coala_coala/tests/results/result_actions/GeneratePatchesActionTest.py | import unittest
import os.path
from coalib.results.Diff import Diff
from coala_utils.ContextManagers import make_temp
from coalib.results.Result import Result
from coalib.results.result_actions.GeneratePatchesAction import (
GeneratePatchesAction)
from coalib.settings.Section import Section, Setting
from coala_uti... | 3,098 | Python | .py | 61 | 36.918033 | 78 | 0.549538 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,202 | DoNothingActionTest.py | coala_coala/tests/results/result_actions/DoNothingActionTest.py | import unittest
from coala_utils.ContextManagers import retrieve_stdout
from coalib.results.Diff import Diff
from coalib.results.Result import Result
from coalib.results.result_actions.DoNothingAction import DoNothingAction
from coalib.settings.Section import Section, Setting
class DoNothingActionTest(unittest.TestC... | 1,350 | Python | .py | 27 | 39.740741 | 76 | 0.598479 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,203 | core-setup.py.jj2 | coala_coala/.moban.dt/core-setup.py.jj2 | {% extends 'coala-setup.py.jj2' %}
{% block local_exec_block_1 %}
assert_supported_version()
class BuildPyCommand(setuptools.command.build_py.build_py):
def run(self):
if platform.system() != 'Windows':
self.run_command('build_manpage')
setuptools.command.build_py.build_py.run(self)
... | 1,176 | Python | .py | 31 | 32.032258 | 76 | 0.627313 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,204 | deps.python-packages.ps1 | coala_coala/.misc/deps.python-packages.ps1 | $ci_directory = $env:FudgeCI
if (!($ci_directory)) {
$ci_directory = '.ci'
}
. $ci_directory/constants.ps1
function Checkpoint-Pip-Constraints {
python -m pip freeze --all > constraints.txt
}
function Install-Pip-Requirement {
param (
[parameter(Mandatory, ValueFromPipeline)]
[string]
... | 5,796 | Python | .py | 144 | 31.951389 | 114 | 0.64603 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,205 | store_env_in_registry.py | coala_coala/.misc/store_env_in_registry.py | import os
KEY = 'System\\CurrentControlSet\\Control\\Session Manager\\Environment'
DISCARD_KEYWORDS = tuple([
'awscli',
'azure',
'coverity',
'dnvm',
'mspec',
'nunit',
'odbc',
'privateassemblies',
'python27',
'ruby193',
'service fabric',
'sql',
'subversion',
'testwindow',
'... | 2,194 | Python | .py | 67 | 26.41791 | 74 | 0.614035 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,206 | deploy.pypi.sh | coala_coala/.misc/deploy.pypi.sh | #!/bin/bash
# Do not use `set -x` here as then it displays the PYPIPW in logs
set -e
# Get environment variables, readily decrypted by rultor
source ../rultor_secrets.sh
# Ship it!
echo "Uploading coala to pypi"
pip3 install twine wheel
python3 setup.py sdist bdist_wheel
# Upload one by one to avoid timeout
twine up... | 772 | Python | .py | 23 | 31.782609 | 75 | 0.726174 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,207 | check_setuptools.py | coala_coala/.misc/check_setuptools.py | #!/usr/bin/env python
from __future__ import print_function
import subprocess
import sys
import setuptools
def get_setuptools_version():
with open('requirements.txt') as f:
for line in f:
if line.startswith('setuptools'):
line = line.rstrip()
if '>=' not in li... | 1,481 | Python | .py | 40 | 28.55 | 79 | 0.594274 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,208 | adjust_version_number.py | coala_coala/.misc/adjust_version_number.py | #!/usr/bin/env python3
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the ho... | 2,865 | Python | .py | 55 | 44.272727 | 78 | 0.646869 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,209 | deploy.pypi.sh | coala_coala/.misc/deploy.pypi.sh | #!/bin/bash
# Do not use `set -x` here as then it displays the PYPIPW in logs
set -e
# Get environment variables, readily decrypted by rultor
source ../rultor_secrets.sh
# Ship it!
echo "Uploading coala to pypi"
pip3 install twine wheel
python3 setup.py sdist bdist_wheel
# Upload one by one to avoid timeout
twine up... | 772 | Python | .pyp | 23 | 31.782609 | 75 | 0.726174 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,210 | deps.python-packages.ps1 | coala_coala/.misc/deps.python-packages.ps1 | $ci_directory = $env:FudgeCI
if (!($ci_directory)) {
$ci_directory = '.ci'
}
. $ci_directory/constants.ps1
function Checkpoint-Pip-Constraints {
python -m pip freeze --all > constraints.txt
}
function Install-Pip-Requirement {
param (
[parameter(Mandatory, ValueFromPipeline)]
[string]
... | 5,796 | Python | .pyt | 144 | 31.951389 | 114 | 0.64603 | coala/coala | 3,548 | 1,308 | 834 | AGPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,211 | mhn.py | pwnlandia_mhn/server/mhn.py | #!/usr/bin/env python
if __name__ == '__main__':
from mhn import mhn
mhn.run(debug=False, host='0.0.0.0', port=8000)
| 127 | Python | .py | 4 | 28.25 | 51 | 0.603306 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,212 | config.py.template | pwnlandia_mhn/server/config.py.template | """
Template to create config.py file.
Do not add 'config.py' to SCM.
"""
import os
from celery.schedules import crontab
_basedir = os.path.abspath(os.path.dirname(__file__))
MHN_SERVER_HOME = _basedir
# Local settings.
DEBUG = {{DEBUG}}
SECRET_KEY = '{{SECRET_KEY}}'
SUPERUSER_EMAIL = '{{SUPERUSER_EMAIL}}'
SUPERUS... | 2,199 | Python | .py | 69 | 28.507246 | 85 | 0.656618 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,213 | manual_password_reset.py | pwnlandia_mhn/server/manual_password_reset.py | from flask_security.utils import encrypt_password
from mhn.auth.models import User
from mhn import mhn, db
import sys
from getpass import getpass
with mhn.test_request_context():
email = raw_input("Enter email address: ").strip()
password = getpass("Enter new password: ")
password2 = getpass("Enter new pa... | 736 | Python | .py | 20 | 31.1 | 58 | 0.692635 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,214 | generateconfig.py | pwnlandia_mhn/server/generateconfig.py | """
This is a helper script meant to generate a
working config.py file from the config template.
"""
from getpass import getpass
import json
import os.path
from random import choice
import string
import sys
from urllib2 import urlopen
import argparse
el = string.ascii_letters + string.digits
rand_str = lambda n: ''... | 7,383 | Python | .py | 151 | 39.695364 | 111 | 0.614391 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,215 | collector_v2.py | pwnlandia_mhn/server/collector_v2.py | import sys
import json
import hpfeeds
import logging
from hpfeedslogger import processors
import pymongo
import requests
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)
logger = logging.ge... | 4,301 | Python | .py | 122 | 28.090164 | 115 | 0.62551 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,216 | collector.py | pwnlandia_mhn/server/collector.py | import sys
import datetime
import json
import hpfeeds
import logging
root = logging.getLogger()
root.setLevel(logging.ERROR)
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)
root.addHandler... | 2,676 | Python | .py | 78 | 27.24359 | 91 | 0.624903 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,217 | manage.py | pwnlandia_mhn/server/manage.py | import os
from urlparse import urlparse
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
try:
import config
except ImportError:
print 'It seems like this is the first time running the server.'
print 'First let us generate a proper configuration file.'
try:
... | 1,700 | Python | .py | 48 | 28.395833 | 82 | 0.6549 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,218 | __init__.py | pwnlandia_mhn/server/mhn/__init__.py | from urlparse import urljoin
from flask import Flask, request, jsonify, abort, url_for, session
from flask_sqlalchemy import SQLAlchemy
from flask_security import Security, SQLAlchemyUserDatastore
from flask_security.utils import encrypt_password as encrypt
from flask_mail import Mail
from werkzeug.contrib.atom import... | 6,027 | Python | .py | 144 | 35.194444 | 89 | 0.669856 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,219 | contextprocessors.py | pwnlandia_mhn/server/mhn/common/contextprocessors.py | from flask import current_app
def config_ctx():
"""
Inserts some settings to be used in templates.
"""
settings = {
'server_url': current_app.config['SERVER_BASE_URL'],
'honeymap_url': current_app.config['HONEYMAP_URL'],
'deploy_key': current_app.config['DEPLOY_KEY'],
'... | 430 | Python | .py | 12 | 30 | 77 | 0.65625 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,220 | ruleutils.py | pwnlandia_mhn/server/mhn/common/ruleutils.py | import re
def _parse_plain(r):
"""
Takes in a plain text rule and returns a dictionary
object containing the parsed information.
Adapted from: jasonish/idstools.py at GitHub.
"""
option_patterns = (
re.compile("(msg)\s*:\s*\"(.*?)\";"),
re.compile("(sid)\s*:\s*(\d+);"),
... | 3,020 | Python | .py | 83 | 27.686747 | 80 | 0.490785 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,221 | clio.py | pwnlandia_mhn/server/mhn/common/clio.py | """
Clio
Mnemosyne Client Library
ThreatStream 2014
"""
import pymongo
from dateutil.parser import parse as parse_date
from collections import Counter
from bson import ObjectId, son
import json
import datetime
class Clio():
"""
Main interface for Clio - Mnemosyne Client Library -
Usage:
clio = Clio... | 16,229 | Python | .py | 414 | 28.173913 | 118 | 0.540711 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,222 | utils.py | pwnlandia_mhn/server/mhn/common/utils.py | from math import ceil
from flask import jsonify, g
from mhn.constants import PAGE_SIZE
def error_response(message, status_code=400):
resp = jsonify({'error': message})
resp.status_code = status_code
return resp
def alchemy_pages(query, **kwargs):
page = kwargs.get('page', g.page)
page_size = k... | 2,535 | Python | .py | 71 | 27.661972 | 64 | 0.592638 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,223 | testcommon.py | pwnlandia_mhn/server/mhn/common/testcommon.py | import os
import json
from flask import url_for
from flask.ext.testing import TestCase
import pymongo
import mhn.common.clio as clio
from mhn import create_clean_db, mhn, db
# Patching clio to use different database than production.
clio_res = (clio.AuthKey, clio.ResourceMixin,)
for res in clio_res:
res.db_name... | 1,627 | Python | .py | 42 | 31.833333 | 84 | 0.648442 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,224 | rules.py | pwnlandia_mhn/server/mhn/tasks/rules.py | import os
import tarfile
from datetime import datetime
try:
from StringIO import cStringIO as StringIO
except ImportError:
from StringIO import StringIO
from flask import current_app as app
import requests
from mhn.tasks import celery
from mhn.api.models import Rule, RuleSource
from mhn.common.ruleutils impor... | 3,236 | Python | .py | 76 | 28.986842 | 97 | 0.545829 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,225 | __init__.py | pwnlandia_mhn/server/mhn/tasks/__init__.py | from celery import Celery
from mhn import mhn
celery = Celery(include=['mhn.tasks.rules'])
celery.conf.update(mhn.config)
TaskBase = celery.Task
class ContextTask(TaskBase):
abstract = True
def __call__(self, *args, **kwargs):
with mhn.app_context():
return TaskBase.__call__(self, *args, ... | 356 | Python | .py | 11 | 28.545455 | 59 | 0.701754 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,226 | utils.py | pwnlandia_mhn/server/mhn/ui/utils.py | import requests
from flask import current_app as app
from mhn.ui import constants
from config import MHN_SERVER_HOME
import os
from werkzeug.contrib.cache import SimpleCache
import socket
import struct
from mhn.api.models import Sensor
import geoip2.database
flag_cache = SimpleCache(threshold=1000, default_timeout=300... | 3,079 | Python | .py | 83 | 30.325301 | 90 | 0.646231 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,227 | views.py | pwnlandia_mhn/server/mhn/ui/views.py | from datetime import datetime, timedelta
from pygal.style import *
import pygal
from flask import (
Blueprint, render_template, request, url_for,
redirect, g)
from flask_security import logout_user as logout
from sqlalchemy import desc, func
from mhn.ui.utils import get_flag_ip, get_sensor_name
from mh... | 9,286 | Python | .py | 226 | 34.90708 | 121 | 0.663552 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,228 | models.py | pwnlandia_mhn/server/mhn/api/models.py | import string
from random import choice
from datetime import datetime
from sqlalchemy import UniqueConstraint, func
from mhn import db
from mhn.api import APIModel
from mhn.auth.models import User
from mhn.common.clio import Clio
class Sensor(db.Model, APIModel):
# Defines some properties on the fields:
# ... | 8,796 | Python | .py | 216 | 31.972222 | 80 | 0.590488 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,229 | errors.py | pwnlandia_mhn/server/mhn/api/errors.py | API_FIELD_NOT_EDITABLE = '"{}" field is not editable.'
API_FIELD_INVALID = '"{}" invalid field.'
API_FIELDS_MISSING = 'Missing required fields: {}.'
API_SENSOR_EXISTS = 'Sensor with name or hostname "{}" already exists.'
API_SOURCE_EXISTS = 'Source with uri "{}" already exists.'
API_NOT_AUTHORIZED = 'Not authorized to ... | 404 | Python | .py | 7 | 56.714286 | 71 | 0.730479 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,230 | __init__.py | pwnlandia_mhn/server/mhn/api/__init__.py | class APIModel(object):
@classmethod
def fields(cls):
return cls.all_fields.keys()
@classmethod
def editable_fields(cls):
return cls._make_field_list('editable')
@classmethod
def required_fields(cls):
return cls._make_field_list('required')
@classmethod
def _ma... | 964 | Python | .py | 29 | 25.310345 | 75 | 0.608602 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,231 | tests.py | pwnlandia_mhn/server/mhn/api/tests.py | import json
from uuid import uuid1
from flask import url_for
from mhn import db
from mhn.common.testcommon import MHNTestCase
from mhn.api.models import Sensor
class SensorTestCase(MHNTestCase):
def setUp(self):
super(SensorTestCase, self).setUp()
self.sensordata = dict(hostname='mhn.test.senso... | 2,430 | Python | .py | 51 | 39.254902 | 78 | 0.66723 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,232 | decorators.py | pwnlandia_mhn/server/mhn/api/decorators.py | from functools import wraps
from flask import request, current_app
from mhn.api import errors
from mhn.api.models import Sensor
from mhn.common.utils import error_response
from mhn.auth import current_user
from mhn.auth.models import ApiKey
def deploy_auth(view):
"""
Authenticates the view, allowing access i... | 2,121 | Python | .py | 55 | 31.109091 | 78 | 0.650632 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,233 | views.py | pwnlandia_mhn/server/mhn/api/views.py | import json
from StringIO import StringIO
import csv
from uuid import uuid1
from sqlalchemy import func
from sqlalchemy.exc import IntegrityError
from flask import Blueprint, request, jsonify, make_response
from bson.errors import InvalidId
from mhn import db, csrf
from mhn.api import errors
from mhn.api.models impo... | 12,767 | Python | .py | 361 | 29.019391 | 134 | 0.625973 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,234 | contextprocessors.py | pwnlandia_mhn/server/mhn/auth/contextprocessors.py | from mhn.auth import current_user
def user_ctx():
"""
Inserts current user templates context.
"""
return dict(user=current_user)
| 147 | Python | .py | 6 | 20.5 | 43 | 0.697842 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,235 | models.py | pwnlandia_mhn/server/mhn/auth/models.py | from datetime import datetime
from flask_security import UserMixin, RoleMixin
from flask import render_template
from mhn import db
from mhn.api import APIModel
roles_users = db.Table(
'roles_users', db.Column('user_id', db.Integer(), db.ForeignKey('user.id')),
db.Column('role_id', db.Integer(), db.F... | 2,215 | Python | .py | 51 | 36.45098 | 88 | 0.643555 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,236 | errors.py | pwnlandia_mhn/server/mhn/auth/errors.py | AUTH_INCORRECT_CREDENTIALS = 'Incorrect username or password.'
AUTH_EMAIL_MISSING = 'Missing required "email" parameter.'
AUTH_PSSWD_MISSING = 'Missing required "password" parameter.'
AUTH_USERNAME_EXISTS = 'Selected username already exists.'
AUTH_NOT_FOUND = 'User {} was not found.'
AUTH_SMTP_ERROR = 'Error sending em... | 459 | Python | .py | 9 | 50 | 62 | 0.771111 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,237 | __init__.py | pwnlandia_mhn/server/mhn/auth/__init__.py | from flask_security import login_required
from flask_security.core import current_user
from flask_security.decorators import roles_accepted
def get_datastore():
from mhn import user_datastore
return user_datastore
| 224 | Python | .py | 6 | 34.666667 | 52 | 0.833333 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,238 | views.py | pwnlandia_mhn/server/mhn/auth/views.py | import hashlib
import random
from flask import Blueprint, request, jsonify
from flask_mail import Message
from sqlalchemy.exc import IntegrityError
from flask_security.utils import (
login_user as login, verify_and_update_password,
encrypt_password, logout_user as logout)
from mhn import db, mail
from... | 5,341 | Python | .py | 136 | 32.544118 | 88 | 0.664096 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,239 | hpfeeds.py | pwnlandia_mhn/server/mhn/static/hpfeeds.py | # ********************************************************************************
# * Dionaea
# * - catches bugs -
# *
# *
# *
# * Copyright (C) 2010 Mark Schloesser
# *
# * This program is free software; you can redistribute it and/or
# * modify it under the te... | 14,065 | Python | .py | 321 | 34.663551 | 110 | 0.604711 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,240 | ihandlers.py | pwnlandia_mhn/server/mhn/static/ihandlers.py | # ********************************************************************************
# * Dionaea
# * - catches bugs -
# *
# *
# *
# * Copyright (C) 2010 Markus Koetter & Tan Kean Siong
# * Copyright (C) 2009 Paul Baecher & Markus Koetter & Mark Schloesser
# *
# * ... | 6,061 | Python | .py | 126 | 42.18254 | 120 | 0.640934 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,241 | install_python2.7.sh | pwnlandia_mhn/scripts/install_python2.7.sh | #!/bin/bash
set -e
set -x
SCRIPTDIR=`dirname "$(readlink -f "$0")"`
MHN_HOME=$SCRIPTDIR/..
if [ -f /etc/debian_version ]; then
OS=Debian # XXX or Ubuntu??
INSTALLER='apt-get'
elif [ -f /etc/redhat-release ]; then
OS=RHEL
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:$PATH
... | 1,065 | Python | .py | 33 | 26.818182 | 95 | 0.634146 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,242 | install_python2.7.sh | pwnlandia_mhn/scripts/install_python2.7.sh | #!/bin/bash
set -e
set -x
SCRIPTDIR=`dirname "$(readlink -f "$0")"`
MHN_HOME=$SCRIPTDIR/..
if [ -f /etc/debian_version ]; then
OS=Debian # XXX or Ubuntu??
INSTALLER='apt-get'
elif [ -f /etc/redhat-release ]; then
OS=RHEL
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:$PATH
... | 1,065 | Python | .pyt | 33 | 26.818182 | 95 | 0.634146 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,243 | attacks.html | pwnlandia_mhn/server/mhn/templates/ui/attacks.html | {% extends "base.html" %}
{% block title %}Attacks{% endblock %}
{% block content %}
<div class="row">
<div class="small-4 large-centered columns">
<h2>Attacks Report</h2>
</div>
</div>
<div class="row">
<div class="small-12 large-centered columns">
<div class... | 4,349 | Python | .tac | 101 | 23.841584 | 131 | 0.373823 | pwnlandia/mhn | 2,424 | 628 | 193 | LGPL-2.1 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,244 | plugin.py | nil0x42_phpsploit/data/plugin-sample/category_name/plugin_example/plugin.py | """Plugin's `plugin.py` file docstring (title line)
SYNOPSIS:
plugin_example
DESCRIPTION:
This plugin is a sample made to understand how
phpsploit plugins are structured.
If the `api` module is imported outside a real plugin
runtime (for example through `corectl python-console`),
then the API... | 949 | Python | .py | 28 | 29.678571 | 66 | 0.742042 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,245 | plugin.py | nil0x42_phpsploit/test/core/core.plugins/test-plugins/valid_category-name/invalid-name.notloaded/plugin.py | """Print working directory
SYNOPSIS:
pwd
DESCRIPTION:
Print the absolute path name of current/working remote
directory on target server.
* PASSIVE PLUGIN:
No requests are sent to server, as current directory
is known by $PWD environment variable (`env PWD`)
AUTHOR:
nil0x42 <http://goo.gl... | 343 | Python | .py | 13 | 22.846154 | 58 | 0.729231 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,246 | plugin.py | nil0x42_phpsploit/test/core/core.plugins/test-plugins/valid_category-name/is-valid/plugin.py | """Print working directory
SYNOPSIS:
is-valid
DESCRIPTION:
test plugin
AUTHOR:
nil0x42 <http://goo.gl/kb2wf>
"""
print("")
| 139 | Python | .py | 9 | 12.666667 | 33 | 0.706349 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,247 | plugin.py | nil0x42_phpsploit/test/core/core.plugins/test-plugins/valid_category-name/cannot-compile/plugin.py | """Print working directory
SYNOPSIS:
is-valid
DESCRIPTION:
test plugin
AUTHOR:
nil0x42 <http://goo.gl/kb2wf>
"""
# this fails with python3
print ""
| 164 | Python | .py | 10 | 13.8 | 33 | 0.726667 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,248 | plugin.py | nil0x42_phpsploit/test/core/core.plugins/test-plugins/valid_category-name/plugin-py_not-readable/plugin.py | """Print working directory
SYNOPSIS:
is-valid
DESCRIPTION:
test plugin
AUTHOR:
nil0x42 <http://goo.gl/kb2wf>
"""
print("")
| 139 | Python | .py | 9 | 12.666667 | 33 | 0.706349 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,249 | plugin.py | nil0x42_phpsploit/test/core/core.plugins/test-plugins/invalid.category/notloaded/plugin.py | """Print working directory
SYNOPSIS:
pwd
DESCRIPTION:
Print the absolute path name of current/working remote
directory on target server.
* PASSIVE PLUGIN:
No requests are sent to server, as current directory
is known by $PWD environment variable (`env PWD`)
AUTHOR:
nil0x42 <http://goo.gl... | 343 | Python | .py | 13 | 22.846154 | 58 | 0.729231 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,250 | plugin.py | nil0x42_phpsploit/test/core/core.plugins/test-plugins/system/is-in-existing_category/plugin.py | """Print working directory
SYNOPSIS:
is-valid
DESCRIPTION:
test plugin
AUTHOR:
nil0x42 <http://goo.gl/kb2wf>
"""
print("")
| 139 | Python | .py | 9 | 12.666667 | 33 | 0.706349 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,251 | x.py | nil0x42_phpsploit/test/unittest/x.py | import sys
import imp
sys.path.pop(0)
def test_windows_os():
sys.platform = "Windows Vista"
try:
imp.load_source("phpsploit", "./phpsploit")
import phpsploit
except SystemExit as err:
errmsg = str(err)
assert "you should be a TARGET rather than an attacker" in errmsg
| 315 | Python | .py | 11 | 23.363636 | 73 | 0.671096 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,252 | metadict.py | nil0x42_phpsploit/src/metadict.py | """Advanced dict-like classes for processing phpsploit
complex session objects.
"""
__all__ = ["MetaDict", "VarContainer"]
from ui.color import colorize
from utils.regex import WORD_TOKEN
class MetaDict(dict):
"""MetaDict() object
An advanced dict() like class with advanced features,
for phpsploit sessi... | 6,510 | Python | .py | 145 | 36.813793 | 78 | 0.61083 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,253 | linebuf.py | nil0x42_phpsploit/src/linebuf.py | """Provide advanced line-buffers for phpsploit session settings"""
import os
import hashlib
import random
from abc import ABC, abstractmethod
import utils.path
from ui.color import colorize
class AbstractLineBuffer(ABC):
r"""Abstract base-class to implement LineBuffer classes
value (mandatory argument):
... | 12,310 | Python | .py | 292 | 32.90411 | 76 | 0.591803 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,254 | __init__.py | nil0x42_phpsploit/src/__init__.py | """Phpsploit framework core loader.
This pseudo module is designed to be imported (import lib) from
the phpsploit script launcher (./phpsploit).
It also can be imported from phpsploit root directory through a
python interpreter for debugging purposes.
It loads the phpsploit core & overwrites sys.path's first element ... | 828 | Python | .py | 20 | 40 | 68 | 0.77875 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,255 | regex.py | nil0x42_phpsploit/src/utils/regex.py | """Pre-compiled regexes for phpsploit
"""
__all__ = ["WORD_TOKEN"]
import re
# check is given string is a valid phpsploit word token
# usage: WORD_TOKEN.fullmatch("string")
WORD_TOKEN = re.compile("[A-Za-z0-9@_.-]+")
| 219 | Python | .py | 7 | 30 | 55 | 0.7 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,256 | path.py | nil0x42_phpsploit/src/utils/path.py | """File path handling
The functions described here provide some aditional features
unavailable in the os.path standard module.
Author: nil0x42
"""
import os
def truepath(*elems):
"""Joins the given path(s), expanding environment variables
and user directory ('~').
"""
expand = lambda s: os.path.exp... | 456 | Python | .py | 14 | 29.214286 | 64 | 0.7254 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,257 | time.py | nil0x42_phpsploit/src/utils/time.py | """Time related functions
Author: nil0x42
"""
import re
import random
import datetime
def get_smart_date(value):
"""Return a date string usable by php strtotime()
>>> get_smart_date("2016-04-15 23:04:12")
'2016-04-15 23:04:12'
>>> # error handling with ValueError() messages
>>> get_smart_date(... | 1,895 | Python | .py | 49 | 32.734694 | 74 | 0.574306 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,258 | __init__.py | nil0x42_phpsploit/src/utils/__init__.py | """Miscelaneous utils for phpsploit internals
"""
# path related utils
from . import path
from . import regex
from . import time
| 130 | Python | .py | 6 | 20.5 | 45 | 0.788618 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,259 | interface.py | nil0x42_phpsploit/src/ui/interface.py | """PhpSploit shell interface
Handles general behavior of Phpsploit interactive command-line interface.
"""
# pylint: disable=too-many-lines
# pylint: disable=too-many-public-methods
__all__ = ["Shell"]
import os
import traceback
import shnake
import core
from core import session, tunnel, plugins, encoding
import dat... | 40,854 | Python | .py | 958 | 30.455115 | 79 | 0.533295 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,260 | console.py | nil0x42_phpsploit/src/ui/console.py | """Run a python console at runtime from Phpsploit
"""
__all__ = ["Console"]
import traceback
# alias exit() to prevent I/O fd closure bug on Console() interpreter
# pylint: disable=redefined-builtin,unused-import
from sys import exit
from ui.color import colorize
from decorators.isolate_readline_context import isolat... | 2,889 | Python | .py | 83 | 25.433735 | 75 | 0.59412 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,261 | color.py | nil0x42_phpsploit/src/ui/color.py | """ANSI Terminal colors handler"""
__all__ = ["colorize", "decolorize", "diff"]
import re
import difflib
ANSI = {"reset": "\x1b[0m", # reset everything
"bold": "\x1b[1m", # bold/bright style
"dim": "\x1b[2;3m", # dim or italic style
"lined": "\x1b[4m", # underline
"bli... | 4,589 | Python | .py | 107 | 35.383178 | 75 | 0.585202 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,262 | wrapper.py | nil0x42_phpsploit/src/ui/output/wrapper.py | """Phpsploit standard output wrapper.
Usage:
>>> import stdout, sys
>>> sys.stdout = Stdout(backlog=True)
>>> print("foo")
foo
>>> print("bar")
bar
>>> log = sys.stdout.backlog # log is now "foo\\nbar\\n"
>>> sys.stdout.backlog = "" # empty the stdout backlog
>>> print("wtf")
wtf
>>> log = sys.stdout.back... | 6,291 | Python | .py | 155 | 32.470968 | 77 | 0.599475 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,263 | __init__.py | nil0x42_phpsploit/src/ui/output/__init__.py | """PhpSploit User Output (STDOUT) Handler
This package provides UI features relaed to Standard Output
"""
__all__ = ["Wrapper", "isatty", "colors", "size", "columns", "lines"]
import os
import sys
import shutil
from .wrapper import Stdout as Wrapper
def isatty() -> bool:
"""True if STDOUT is connected to a tty... | 1,140 | Python | .py | 32 | 31.59375 | 69 | 0.673973 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,264 | expect.py | nil0x42_phpsploit/src/ui/input/expect.py | """Easily ask for user choice from terminal"""
__all__ = ["Expect"]
import os
import sys
import signal
from decorators.isolate_readline_context import isolate_readline_context
from ..color import colorize
from ..output import isatty
class Expect: # pylint: disable=too-few-public-methods
"""Expect some user inp... | 8,557 | Python | .py | 187 | 34.545455 | 73 | 0.596592 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,265 | __init__.py | nil0x42_phpsploit/src/ui/input/__init__.py | """PhpSploit User Input (STDIN) Handler
This package provides UI features relaed to Standard Input
"""
__all__ = ["Expect", "isatty"]
import sys
from .expect import Expect
def isatty() -> bool:
"""Return whether input is an 'interactive' stream.
Return False if it can't be determined.
"""
return sy... | 341 | Python | .py | 11 | 28.090909 | 58 | 0.704615 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,266 | plugin.py | nil0x42_phpsploit/src/api/plugin.py | """Provide access to attributes of currently running plugin"""
__all__ = ["plugin"]
import re
from core import plugins
class Plugin:
"""Get access to currently running plugin attributes.
Usage:
>>> from api import plugin
Attributes:
* name (type: str)
# Plugin name.
>>> plugin.... | 1,513 | Python | .py | 45 | 26.088889 | 75 | 0.596974 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,267 | __init__.py | nil0x42_phpsploit/src/api/__init__.py | """Phpsploit plugin developer API
This package includes the python-side plugin
development API.
CONTENTS:
* plugin (type: api.plugin.Plugin())
Access running plugin attributes
* environ (type: dict)
Access phpsploit session's Environment Variables
* server (type: package)
Provides target server related... | 737 | Python | .py | 23 | 29.434783 | 55 | 0.770213 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,268 | path.py | nil0x42_phpsploit/src/api/server/path.py | """Common operation on phpsploit target server pathnames.
These functions are designed for use in phpsploit plugins,
for normalizing and extracting server path components.
This module is highly inspired by `os.path` from standard library.
"""
import re
from core import session
_WINPATH_REGEX = re.compile(r"[a-zA-Z]... | 3,279 | Python | .py | 99 | 26.858586 | 71 | 0.590174 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,269 | payload.py | nil0x42_phpsploit/src/api/server/payload.py | import metadict
from core import session, tunnel, plugins
from datatypes import Path
class Payload(metadict.MetaDict):
# the phpsploit env vars to auto add
# to $PHPSPLOIT array on php side
_unherited_env_vars = ["PATH_SEP"]
_php_vars_template = 'global $PHPSPLOIT;$PHPSPLOIT=%s;\n'
def __init__(... | 1,150 | Python | .py | 27 | 35.222222 | 76 | 0.654709 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,270 | __init__.py | nil0x42_phpsploit/src/api/server/__init__.py | """Phpsploit operations on target server.
This module includes a collection of submodules
designed for phpsploit server-side operations.
CONTENTS:
* path (type: submodule)
Common operation on target server pathnames.
* payload (type: submodule)
The phpsploit payload request manager.
"""
from . import path... | 343 | Python | .py | 11 | 28.909091 | 48 | 0.800613 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,271 | isolate_readline_context.py | nil0x42_phpsploit/src/decorators/isolate_readline_context.py | """A decorator for separating readline context.
"""
def isolate_readline_context(function):
"""A decorator for separating readline context.
This decorator isolates readline context of target
function or method.
Use when phpsploit's readline context should be
reset temporarly is the context of tr... | 1,585 | Python | .py | 41 | 28.170732 | 62 | 0.611726 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,272 | __init__.py | nil0x42_phpsploit/src/decorators/__init__.py | """Miscelaneous decorators.
Collection of decorators used by the phpsploit framework's core
"""
| 98 | Python | .py | 3 | 31 | 63 | 0.817204 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,273 | isolate_io_context.py | nil0x42_phpsploit/src/decorators/isolate_io_context.py | """A decorator for separating I/O context.
"""
import sys
def isolate_io_context(function):
"""A decorator for separating I/O context.
This decorator isolates I/O context of target
function or method.
I/O Context is a mix of terminal related elements,
such as current stdout and readline complete... | 1,854 | Python | .py | 49 | 27.755102 | 62 | 0.609688 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,274 | readonly_settings.py | nil0x42_phpsploit/src/decorators/readonly_settings.py | """A decorator for limiting session settings scope.
The readonly_settings decorator takes an undefined number of
string arguments, representing the names of the settings
to backup, in order to force them to be kept back after
function execution.
If no arguments are set, then all session settings will
be write protect... | 1,985 | Python | .py | 56 | 28.982143 | 62 | 0.644085 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,275 | demo.py | nil0x42_phpsploit/src/shnake-0.5/demo/demo.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
# Ensure that the script is not run with python 2.x
if (sys.version_info.major < 3):
sys.exit('shnake library is not compatible with python < 3')
# Ensure the script is not imported
try:
from __main__ import __file__
del __file__
except:
sys.e... | 1,301 | Python | .py | 43 | 28.72093 | 69 | 0.720224 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,276 | lexer.py | nil0x42_phpsploit/src/shnake-0.5/shnake/lexer.py | """Shnake's pyparsing based shell lexer
Based on the awesome pyparsing library, the Lexer class intends to provide
a powerful bash-like string lexer.
"""
import re
__author__ = "nil0x42 <http://goo.gl/kb2wf>"
class Lexer:
r"""Bash-like string lexer based on pyparsing.
It implements a very basic bash insp... | 5,381 | Python | .py | 116 | 34.672414 | 74 | 0.531346 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,277 | __init__.py | nil0x42_phpsploit/src/shnake-0.5/shnake/__init__.py | _version__ = "0.5"
__author__ = "nil0x42 <http://goo.gl/kb2wf>"
from .lexer import Lexer, lex
from .parser import Parser, parse
from .shell import Shell
| 154 | Python | .py | 5 | 29.6 | 44 | 0.716216 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,278 | shell.py | nil0x42_phpsploit/src/shnake-0.5/shnake/shell.py | r"""A generic command interpreter with multicommand support.
The cmdshell library has been initially developped to correctly handle
PhpSploit framework's shell interfaces. That being said, it was built
in order to stand generic, and usable by any other open-source project.
It extends the pretty good 'cmd' library, ad... | 16,920 | Python | .py | 380 | 34.642105 | 79 | 0.619429 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,279 | parser.py | nil0x42_phpsploit/src/shnake-0.5/shnake/parser.py | """Shnake's pyparsing based shell parser
The shnake parser handles multiline commands using the lexer
Take a look at shell.py parserline() and lex() methods.
"""
import io
from .lexer import lex as shnake_lex
__author__ = "nil0x42 <http://goo.gl/kb2wf>"
class LineBuffer:
"""Command line generator designed for... | 1,661 | Python | .py | 51 | 22.784314 | 65 | 0.547289 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,280 | config.py | nil0x42_phpsploit/src/core/config.py | """User configuration manager.
Browse, initialize and load PhpSploit framework user
configuration directory and elements.
"""
import os
import errno
import utils.path
from datatypes import Path
from . import BASEDIR
class UserDir: # pylint: disable=too-few-public-methods
"""PhpSploit Configuration Directory
... | 3,130 | Python | .py | 78 | 29.461538 | 73 | 0.583718 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,281 | encoding.py | nil0x42_phpsploit/src/core/encoding.py | """Generic encoding handler.
This small string encoding/decoding manager aims to provide
an uniform encoding handling policy for the phpsploit framework.
"""
import sys
import codecs
try:
codecs.lookup("utf-8")
default_encoding = "utf-8"
except LookupError:
default_encoding = sys.getdefaultencoding()
t... | 1,244 | Python | .py | 32 | 35.09375 | 76 | 0.743973 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,282 | __init__.py | nil0x42_phpsploit/src/core/__init__.py | """PhpSploit base core elements loader.
The most basic PhpSploit elements manager.
It handles user configuration directory, and defines
basic elements such as the following strings:
BASEDIR -> /path/to/phpsploit/
COREDIR -> /path/to/phpsploit/core/
USERDIR -> /home/user/.phpsploit/
"""
# constant directori... | 528 | Python | .py | 17 | 29.117647 | 52 | 0.798817 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,283 | compat_handler.py | nil0x42_phpsploit/src/core/tunnel/compat_handler.py | """Backwards compatible tunnel handler for
phpsploit v1 backdoors, aka:
<?php eval(base64_decode($_POST[%%PASSKEY%%])); ?>
"""
__all__ = ["Request_V1_x"]
from . import handler
from .exceptions import BuildError
class Request_V1_x(handler.Request):
def __init__(self):
"""Force default method to POST,... | 837 | Python | .py | 22 | 32.045455 | 74 | 0.666255 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,284 | connector.py | nil0x42_phpsploit/src/core/tunnel/connector.py | """Open a new connection to remote TARGET
"""
__all__ = ["Request"]
import core
from datatypes import Path
from . import handler
class Request:
"""Handle virtual `tunnel` between attacker and remote TARGET.
"""
def __init__(self):
self.socket = None
self.environ = {}
def open(self)... | 4,001 | Python | .py | 96 | 31.46875 | 79 | 0.546251 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,285 | payload.py | nil0x42_phpsploit/src/core/tunnel/payload.py | """Handle communication between python client and PHP backdoor"""
__all__ = ["py2php", "php2py", "Build", "Encode"]
import codecs
import base64
import phpserialize
import core
from core import session
from core import encoding
from datatypes import Path
from .exceptions import BuildError
def _phpserialize_recursiv... | 8,171 | Python | .py | 198 | 31.782828 | 79 | 0.601865 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,286 | __init__.py | nil0x42_phpsploit/src/core/tunnel/__init__.py | """Phpsploit remote tunnel manager.
Usage:
>>> from core import tunnel
>>> if not tunnel:
>>> tunnel.open()
>>> tunnel.send("a php payload")
>>> else:
>>> tunnel.close()
"""
__all__ = ["tunnel"]
from core import session
import ui.input
import ui.color
from . import handler
from . import connector
from . ... | 3,285 | Python | .py | 87 | 26.965517 | 77 | 0.555171 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,287 | exceptions.py | nil0x42_phpsploit/src/core/tunnel/exceptions.py | """Phpsploit requests and tunnel exceptions
"""
__all__ = ["BuildError", "RequestError", "ResponseError"]
class TunnelException(Exception):
"""Parent class for tunnel exception types
"""
class BuildError(TunnelException):
"""Tunnel request builder exception
This exception is raised by the tunnel ha... | 982 | Python | .py | 25 | 34.84 | 57 | 0.751856 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,288 | handler.py | nil0x42_phpsploit/src/core/tunnel/handler.py | """Phpsploit HTTP request handler"""
__all__ = ["Request", "new_request", "get_raw_requests"]
import sys
import re
import math
import uuid
import time
import codecs
import base64
import zlib
import urllib.request
import urllib.parse
import http.client
import ssl
import core
from core import session
from datatypes imp... | 38,757 | Python | .py | 801 | 37.048689 | 80 | 0.591844 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,289 | compat_session.py | nil0x42_phpsploit/src/core/session/compat_session.py | """Backwards compatible session loader.
This module loads a phpsploit session file which
have been generated by old phpsploit versions
which uses different format.
"""
# pylint: disable=no-self-use
# pylint: disable=invalid-name
import copy
import pickle
from core import encoding
def rename_key(dictionnary, old_k... | 4,778 | Python | .py | 120 | 30.666667 | 73 | 0.591391 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,290 | environment.py | nil0x42_phpsploit/src/core/session/environment.py | """Phpsploit Environment Variables"""
import re
import copy
import metadict
from utils.regex import WORD_TOKEN
class Environment(metadict.VarContainer):
"""Environment Variables
Instanciate a dict() like object that stores PhpSploit
environment variables.
Unlike settings, env vars object works exa... | 3,391 | Python | .py | 88 | 29.295455 | 77 | 0.572298 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,291 | history.py | nil0x42_phpsploit/src/core/session/history.py | """Session History
"""
class History(list):
"""Commands history.
This class is a specialisation of the list() obj, designed
to store command line strings only.
It maintains a `size` property which gives the full size (in bytes)
of all strings in array.
To do it, the class operates overriding... | 947 | Python | .py | 29 | 25.448276 | 71 | 0.614286 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,292 | __init__.py | nil0x42_phpsploit/src/core/session/__init__.py | """PhpSploit Session Manager
When imorted for the first time, the "session" package initializes it
self as a PhpSploit blank session, with its default values.
Provide the PhpSploit framework's session object from Session() class.
On import, an instance of it is defaultly created as `session`.
A session instance con... | 12,388 | Python | .py | 303 | 29.729373 | 77 | 0.555722 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,293 | REQ_ZLIB_TRY_LIMIT.py | nil0x42_phpsploit/src/core/session/settings/REQ_ZLIB_TRY_LIMIT.py | """
Control over which payload size the zlib compression feature
will be disabled.
The phpsploit request engine does'its best to compress and fit
the payload within as little HTTP Requests as possible.
Therefore, zlib compression becomes exponentially CPU greedy
as payload size gows up, and it might be extremelly slo... | 862 | Python | .py | 23 | 35.043478 | 64 | 0.801205 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,294 | BACKDOOR.py | nil0x42_phpsploit/src/core/session/settings/BACKDOOR.py | """
This setting allows overriding default backdoor template.
It is used to generate the backdoor to be injected in TARGET url.
This setting can be changed to improve stealth. Using a different
template than the default one is a good was to bypass static
Antivirus/IDS signatures.
Make sure that the global behavior re... | 889 | Python | .py | 22 | 37.772727 | 65 | 0.766628 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,295 | PAYLOAD_PREFIX.py | nil0x42_phpsploit/src/core/session/settings/PAYLOAD_PREFIX.py | """
This variable contains php code which is interpreted
on each http request, just before payload execution.
This setting can be used for example in order to
override a php configuration option with a value
that extends execution scope.
The code will be executed before ANY payload execution.
* Only edit PAYLOAD_PRE... | 668 | Python | .py | 19 | 32.842105 | 69 | 0.804688 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,296 | SAVEPATH.py | nil0x42_phpsploit/src/core/session/settings/SAVEPATH.py | """
Default directory to save and load phpsploit session files.
* EXAMPLE:
If SAVEPATH is '/dev/shm', running `session load foo.session`
will implicitly try to load '/dev/shm/foo.session.
This setting also affetcs the `session save` command.
"""
import tempfile
import linebuf
import datatypes
linebuf_type = linebu... | 463 | Python | .py | 15 | 28.733333 | 61 | 0.790433 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,297 | TMPPATH.py | nil0x42_phpsploit/src/core/session/settings/TMPPATH.py | """
Default phpsploit temporary directory.
* USE CASES:
Used as base path for files edited with `edit` plugin.
"""
import tempfile
import linebuf
import datatypes
linebuf_type = linebuf.MultiLineBuffer
def validator(value):
return datatypes.Path(value, mode="drw")
def default_value():
return tempfile.ge... | 331 | Python | .py | 13 | 23.230769 | 54 | 0.793548 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,298 | REQ_DEFAULT_METHOD.py | nil0x42_phpsploit/src/core/session/settings/REQ_DEFAULT_METHOD.py | """
Default HTTP method to use to communicate with TARGET.
The phpsploit framework supports both GET and POST methods
to send HTTP requests
* GET METHOD:
-------------
# BEHAVIOR:
The PASSKEY payload stager is passed as a single HTTP header,
and a set of HTTP headers are created, and fullfilled with
a por... | 1,617 | Python | .py | 44 | 33.181818 | 66 | 0.737852 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |
37,299 | EDITOR.py | nil0x42_phpsploit/src/core/session/settings/EDITOR.py | """
Set attacker's prefered text editor.
* USE CASES:
# open TARGET setting content with EDITOR:
> set TARGET +
# use `edit` plugin to edit a remote file locally with EDITOR:
> edit /var/www/html/index.php
"""
import os
import linebuf
import datatypes
linebuf_type = linebuf.MultiLineBuffer
def validator(value):
... | 494 | Python | .py | 19 | 23.263158 | 62 | 0.740343 | nil0x42/phpsploit | 2,187 | 437 | 27 | GPL-3.0 | 9/5/2024, 5:15:29 PM (Europe/Amsterdam) |