Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Predict the next line for this snippet: <|code_start|># ~ Tune In # # Tuned to: # # https://cymon.io # # # # ...
self.api = helpers.Common()
Using the snippet: <|code_start|># # # hash_to_score - Return Score to given <Hash> # # hash_to_url - Return URL to report for given <Hash> # ################################################################# class Virustotal(obj...
if config.virustotal_api_key:
Based on the snippet: <|code_start|># API Documentation: # # https://www.virustotal.com/en/documentation/public-api/ # # # # Author: 10TOHH # # ...
self.api = helpers.Common()
Next line prediction: <|code_start|># hash_to_score - Return Score to given <Hash> # ################################################################# class Metascan(object): def __init__(self): # lists of values that can be returned self.ip_list = [] self.domain_list = [...
if config.metascan_api_key:
Predict the next line for this snippet: <|code_start|># Metascan station for QRadio # # ~ Tune In # # Tuned to: # # https://www.metascan-online.com # # ...
self.api = helpers.Common()
Given the code snippet: <|code_start|>################################################################# # Hostsfile station for QRadio # # ~ Tune In # # Tuned to: # # http:...
self.api = helpers.Common()
Predict the next line for this snippet: <|code_start|># http://www.threatcrowd.org/ API v2 # # # # API Documentation: # # https://github.com/threatcrowd/ApiV2 # # ...
self.api = helpers.Common()
Based on the snippet: <|code_start|>################################################################# class Malwr(object): logged = False url = "https://malwr.com" headers = { 'User-Agent': "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) " + "Gecko/20100101 Firefox/41.0"...
if config.malwr_login and config.malwr_passwd:
Here is a snippet: <|code_start|># ipv4_to_url - Return URL to report for given <IP> # # # # hash_to_ipv4 - Return IP associated with <Hash> # # hash_to_imphash - Return Imphash associated with <Hash> # # hash_to_url - ...
self.error_log = helpers.IO()
Here is a snippet: <|code_start|> class Station_name(object): def __init__(self): # lists of values that can be returned self.ip_list = [] self.domain_list = [] self.hash_list = [] self.url_list = [] self.score_list = [] self.imphash_list = [] # get ...
self.api = helpers.Common()
Here is a snippet: <|code_start|>################################################################# # Fortiguard station for QRadio # # ~ Tune In # # Tuned to: # # http://www...
self.api = helpers.Common()
Next line prediction: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- ''' This module manages the version info. ''' # Imports ##################################################################### # Metadata #################################################################### __author__ = 'Timothy McFadde...
text = open(VER_FILE).read()
Given the code snippet: <|code_start|> if not match: raise Exception("Could not get version") return match.group('version') @task def rev(): """Increases the 'minor' version number by 1""" text = open(VER_FILE).read() whole, ver = re.search("^(__version__\s+=\s+['\"](.*?)['\"]\s*)$", text...
text = open(DOCS_CONF_FILE).read()
Based on the snippet: <|code_start|># Globals ##################################################################### RE_VERSION = re.compile( '^__version__\s*=\s*[\'"](?P<version>.*?)[\'"]\s*?^', re.MULTILINE) def get_version(): '''Gets the current version''' text = open(VER_FILE).read() match = RE_VER...
while not true(val):
Based on the snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- ''' This module hold fabric management functions dealing with Git ''' # Imports ##################################################################### # Metadata #################################################################### __au...
(text, _) = ex(['git', 'rev-parse', '--abbrev-ref', 'HEAD'])
Using the snippet: <|code_start|> '''Returns True if nothing is staged or untracked''' (text, _) = ex(['git', 'status', '--porcelain']) return (not bool(text), text) @task def get_tags(): '''Returns a list of tags''' result = [] (text, _) = ex('git tag -l --sort=version:refname "*"') for l...
name = user_input("Enter tag to create [default to: %s]: " % default_version)
Continue the code snippet: <|code_start|> '''Returns a list of tags''' result = [] (text, _) = ex('git tag -l --sort=version:refname "*"') for line in text.splitlines(): result.append(VERSIONED_TAG(line, parse_version(line))) return sorted(result, cmp=lambda x, y: cmp(x.version, y.version))...
if not true(answer):
Continue the code snippet: <|code_start|>VERSIONED_TAG = namedtuple('VersionedTag', 'string version') def on_master(): '''Returns True if we're currently on the master branch''' (text, _) = ex(['git', 'rev-parse', '--abbrev-ref', 'HEAD']) return "master" in text.lower() def is_clean(): '''Returns Tr...
current_version = get_version()
Given the following code snippet before the placeholder: <|code_start|> if not message: message = get_release_notes(tag) r = repo() r.create_git_release(tag, tag, message) def _upload(): tag = get_tags()[-1] # Make sure the release exists r = repo() github_release = next(( ...
upload_bin = os.path.join(LIB_DIR, 'bin', 'github-release.exe')
Given the following code snippet before the placeholder: <|code_start|> print([x.name for x in u.get_repos()]) @task def create_release(tag=None, message=None): '''Create a GitHub release''' if not tag: tag = get_tags()[-1].string if not message: message = get_release_notes(tag) r...
for fname in os.listdir(DIST_DIR):
Given snippet: <|code_start|> # Make sure the release exists r = repo() github_release = next(( x for x in r.get_releases() if x.tag_name == tag.string), None) if not github_release: create_release(tag.string) # Find the tarball path = None for fname in os.listdir(DI...
ex(cmd)
Using the snippet: <|code_start|> @task def create_release(tag=None, message=None): '''Create a GitHub release''' if not tag: tag = get_tags()[-1].string if not message: message = get_release_notes(tag) r = repo() r.create_git_release(tag, tag, message) def _upload(): tag = g...
path = abspath(DIST_DIR, fname)
Predict the next line after this snippet: <|code_start|># Metadata #################################################################### __author__ = 'Timothy McFadden' __creationDate__ = '14-APR-2017' # Globals ##################################################################### GITHUB_USER = os.environ['GH_USERNAME...
tag = get_tags()[-1].string
Continue the code snippet: <|code_start|> # Globals ##################################################################### GITHUB_USER = os.environ['GH_USERNAME'] GITHUB_TOKEN = os.environ['GH_TOKEN'] REPO_NAME = 'pyclimenu' def repo(): '''Retrieve the GitHub repo''' g = github.Github(GITHUB_USER, GITHUB_TOKE...
message = get_release_notes(tag)
Predict the next line for this snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- ''' This module holds the management functions for interacting wity Pypi ''' # Imports ##################################################################### # Metadata #################################################...
ex(command)
Using the snippet: <|code_start|># coding: utf-8 """ This script is used for project management. See Fabric documentation for more info: http://docs.fabfile.org/en/1.10/index.html """ # Imports ##################################################################### from __future__ import print_function # Int...
if true(html):
Given the following code snippet before the placeholder: <|code_start|>#!/usr/bin/env python2.7 # coding: utf-8 """ This script is used for project management. See Fabric documentation for more info: http://docs.fabfile.org/en/1.10/index.html """ # Imports #####################################################...
def _get(version=None, path=RELEASE_NOTES_FILE, html='n', display='n'):
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python2.7 # coding: utf-8 """ This script is used for project management. See Fabric documentation for more info: http://docs.fabfile.org/en/1.10/index.html """ # Imports ####################################################################...
version = version or get_version()
Next line prediction: <|code_start|> # Metadata #################################################################### __author__ = 'Timothy McFadden' __creationDate__ = '14-APR-2017' # Globals ##################################################################### def _build(): pass @task def build(): '''Buil...
ex(command)
Based on the snippet: <|code_start|># Imports ##################################################################### # Metadata #################################################################### __author__ = 'Timothy McFadden' __creationDate__ = '14-APR-2017' # Globals ############################################...
remove_directory(dist_dir, remove_top=False)
Continue the code snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- ''' This module holds the function for building the python installers. ''' # Imports ##################################################################### # Metadata ###############################################################...
dist_dir = os.path.join(LIB_DIR, 'dist')
Based on the snippet: <|code_start|> class SubscriptionContext: next_proc_id = 1 def __init__(self, address, objectID, confirmed=None, lifetime=None, callback=None): self.address = address self.subscriberProcessIdentifier = SubscriptionContext.next_proc_id SubscriptionContext.next_proc_...
value = cast_datatype_from_tag(
Using the snippet: <|code_start|> def create_BI(oid=1, pv=0, name="BI", activeText="On", inactiveText="Off"): deprecate_msg() return BinaryInputObject( objectIdentifier=("binaryInput", oid), objectName=name, presentValue=pv, activeText=activeText, inactiveText=inactiveTex...
boo = LocalBinaryOutputObjectCmd(
Given the following code snippet before the placeholder: <|code_start|> """ This sample creates an Excel file containing one sheet per controller found on the network Each sheet contyains all the points known by BAC0. Some proprietary point could not display here. """ EXCEL_FILE_NAME = "all_controllers_and_points.xlsx...
custom_obj_list = tec_short_point_list()
Predict the next line for this snippet: <|code_start|> def points_from_sql(self, db_name): """ Retrieve point list from SQL database """ points = self._read_from_sql("SELECT * FROM history;", db_name) return list(points.columns.values)[1:] def his_from_sql(self, db_name,...
raise RemovedPointException(
Given the following code snippet before the placeholder: <|code_start|> ) else: return df def save(self, filename=None, resampling=None): """ Save the point histories to sqlite3 database. Save the device object properties to a pickle file so the device can be ...
except (DataError, NoResponseFromController):
Given the following code snippet before the placeholder: <|code_start|> self.ip = ip self.notifications_log = [] self.notifications_list = "" self.config_flask_app() self.exitFlag = False @property def network(self): return self._network_ref() def r...
sidebar=create_sidebar(trends_class='class="active"'),
Given the code snippet: <|code_start|> self.flask_app.run(port=self.port, host="0.0.0.0") self.flask_app.logger.removeHandler(default_handler) def config_flask_app(self): @self.flask_app.route("/trends", methods=["GET"]) def bkapp_trends_page(): if self.network.regi...
cnod = create_card(
Given the following code snippet before the placeholder: <|code_start|> icon="ti-server", title="Number of devices", data=self.network.number_of_devices, id_data="devices", foot_icon="ti-reload", foot_data="Refresh to up...
notif = update_notifications(self.notifications_log, None)
Given the code snippet: <|code_start|> request = WritePropertyRequest( objectIdentifier=(obj_type, obj_inst), propertyIdentifier=prop_id ) request.pduDestination = Address(addr) _value = Any() _value.cast_in(CharacterString(value)) request.propertyValue = _val...
raise NoResponseFromController("APDU Abort Reason : {}".format(reason))
Continue the code snippet: <|code_start|> ) request.pduDestination = Address(addr) _value = Any() _value.cast_in(CharacterString(value)) request.propertyValue = _value return request def write_text_value(self, request, timeout=10): try: iocb = IO...
except WritePropertyException as error:
Predict the next line after this snippet: <|code_start|> ): request = WritePropertyRequest( objectIdentifier=(obj_type, obj_inst), propertyIdentifier=prop_id ) request.pduDestination = Address(addr) _value = Any() _value.cast_in(CharacterString(value)) req...
reason = find_reason(apdu)
Using the snippet: <|code_start|>#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (C) 2015 by Christian Tremblay, P.Eng <christian.tremblay@servisys.com> # # Licensed under LGPLv3, see file LICENSE in this source tree. """ Utility function to retrieve a functionnal IP and a correct broadcast IP address. Goal : n...
@note_and_log
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python # -*- coding utf-8 -*- """ Test Bacnet communication with another device """ VENDOR_ID = 842 @pytest.fixture(scope="session") def host_ip(): <|code_end|> using the current file's imports: from BAC0.core.functions.GetIPAddr import HostI...
hip = HostIP()
Given snippet: <|code_start|>#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # BAC0 documentation build configuration file, created by # sphinx-quickstart on Sat Sep 5 21:28:35 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration value...
from BAC0 import infos as infos
Given snippet: <|code_start|> """ if not self._started: raise ApplicationNotStarted("BACnet stack not running - use startApp()") # with self.this_application._lock: if use lock...won't be able to call read... args = args.split() addr, obj_type, obj_inst, prop_id...
raise OutOfServiceNotSet()
Given the following code snippet before the placeholder: <|code_start|> raise ApplicationNotStarted("BACnet stack not running - use startApp()") # with self.this_application._lock: if use lock...won't be able to call read... args = args.split() addr, obj_type, obj_inst = args[:3]...
raise OutOfServiceSet()
Predict the next line after this snippet: <|code_start|> class Simulation: """ Global informations regarding simulation """ def sim(self, args): """ Simulate I/O points by setting the Out_Of_Service property, then doing a WriteProperty to the point's Present_Value. ...
except NoResponseFromController as e:
Next line prediction: <|code_start|># # Copyright (C) 2015 by Christian Tremblay, P.Eng <christian.tremblay@servisys.com> # Licensed under LGPLv3, see file LICENSE in this source tree. # """ Simulate.py - simulate the value of controller I/O values """ # --- standard Python modules --- # --- 3rd party modules...
raise ApplicationNotStarted("BACnet stack not running - use startApp()")
Given the code snippet: <|code_start|>""" Setup.py """ requirements = ["bacpypes", "colorama"] setup( name="BAC0", <|code_end|> , generate the next line using the imports in this file: from setuptools import setup from BAC0 import infos and context (functions, classes, or occasionally code) from other files: #...
version=infos.__version__,
Next line prediction: <|code_start|> ## A list of time-stamped edges of this temporal network self.tedges = [] ## A list of nodes of this temporal network self.nodes = [] ## A dictionary storing all time-stamped links, indexed by time-stamps self.time = _co.defa...
Log.add('Building index data structures ...')
Predict the next line after this snippet: <|code_start|> @param maxlines: limit reading of file to certain number of lines, default sys.maxsize """ assert (filename != ''), 'Empty filename given' # Read header with open(filename, 'r') as f: tedges = [] ...
Log.add('No time stamps found in data, assuming consecutive links', Severity.WARNING)
Given the following code snippet before the placeholder: <|code_start|> def getDoF(self, assumption="paths"): """ Calculates the degrees of freedom (i.e. number of parameters) of this k-order model. Depending on the modeling assumptions, this either corresponds to the number of paths...
Log.add('Calculating distance matrix in higher-order network (k = ' + str(self.order) + ') ...', Severity.INFO)
Here is a snippet: <|code_start|> def getDoF(self, assumption="paths"): """ Calculates the degrees of freedom (i.e. number of parameters) of this k-order model. Depending on the modeling assumptions, this either corresponds to the number of paths of length k in the first-order networ...
Log.add('Calculating distance matrix in higher-order network (k = ' + str(self.order) + ') ...', Severity.INFO)
Given the code snippet: <|code_start|> def __init__(self, sequence): """ Generates a Markov model for a sequence, given as a single list of strings """ ## The sequence to be modeled self.sequence = sequence ## The transition probabilities of higher-order Mar...
Log.add('Fitting Markov model with order k = ' + str(k))
Given snippet: <|code_start|> client = paho_mqtt.Client() client.username_pw_set(token, token) client.on_connect = on_mqtt_connect client.on_disconnect = on_mqtt_disconnect client.on_message = on_mqtt_message client.on_subscribe = on_mqtt_subscribe client.connect(h...
return [Asset.from_dict(asset_dict) for asset_dict in r.json()]
Given the following code snippet before the placeholder: <|code_start|> :rtype: Asset """ attalk_asset = { 'Name': asset.name, 'Title': asset.title, 'Description': asset.description, 'Is': asset.kind, 'Profile': asset.profile } ...
return AssetState(
Predict the next line for this snippet: <|code_start|> :param Asset asset: The asset :return: The asset :rtype: Asset """ attalk_asset = { 'Name': asset.name, 'Title': asset.title, 'Description': asset.description, 'Is': asset.kind,...
raise AssetStateRetrievalException()
Given the following code snippet before the placeholder: <|code_start|> self._devices[device_id]._on_message(stream, asset_name, message.payload) client = paho_mqtt.Client() client.username_pw_set(token, token) client.on_connect = on_mqtt_connect client.on_disconnect = on_mqt...
raise AccessForbiddenException('Could not use token "%s" to access device "%s" on "%s".'
Using the snippet: <|code_start|> proc.connect(self.on_done, event="done") self.add(proc) self.on_change(proc) return proc def on_change(self, proc): pass def on_done(self, proc): self.remove(proc) def remove(self, proc): to_be_removed = [] ...
assert isinstance(view, FlatCAMActivityView), \
Continue the code snippet: <|code_start|> #from mpl_toolkits.axes_grid.anchored_artists import AnchoredDrawingArea class BufferSelectionTool(FlatCAMTool): """ Simple input for buffer distance. """ toolName = "Buffer Selection" def __init__(self, app, fcdraw): FlatCAMTool.__init__(self...
self.buffer_distance_entry = LengthEntry()
Based on the snippet: <|code_start|> class WorkerStack(QtCore.QObject): worker_task = QtCore.pyqtSignal(dict) # 'worker_name', 'func', 'params' thread_exception = QtCore.pyqtSignal(object) def __init__(self): super(WorkerStack, self).__init__() self.workers = [] sel...
worker = Worker(self, 'Slogger-' + str(i))
Given snippet: <|code_start|> Input shape data :param triangulation: str Triangulation engine """ mesh_vertices = [] # Vertices for mesh mesh_tris = [] # Faces for mesh mesh_colors = [] ...
gt = GLUTess()
Given the following code snippet before the placeholder: <|code_start|>############################################################ log = logging.getLogger('base') class PlotCanvas(QtCore.QObject): """ Class handling the plotting area in the application. """ def __init__(self, container, app): ...
self.vispy_canvas = VisPyCanvas()
Next line prediction: <|code_start|> # self.shape_collections = [] self.shape_collection = self.new_shape_collection() self.app.pool_recreated.connect(self.on_pool_recreated) self.text_collection = self.new_text_collection() # TODO: Should be setting to show/hide CNC job annota...
return ShapeGroup(self.shape_collection)
Given snippet: <|code_start|> # TODO: Should be setting to show/hide CNC job annotations (global or per object) self.text_collection.enabled = False def vis_connect(self, event_name, callback): return getattr(self.vispy_canvas.events, event_name).connect(callback) def vis_disconnect(se...
return ShapeCollection(parent=self.vispy_canvas.view.scene, pool=self.app.pool, **kwargs)
Here is a snippet: <|code_start|> """ Zooms the plot by factor around a given center point. Takes care of re-drawing. :param factor: Number by which to scale the plot. :type factor: float :param center: Coordinates [x, y] of the point around which to scale the plot. ...
return TextCollection(parent=self.vispy_canvas.view.scene, **kwargs)
Next line prediction: <|code_start|> getattr(self.vispy_canvas.events, event_name).disconnect(callback) def zoom(self, factor, center=None): """ Zooms the plot by factor around a given center point. Takes care of re-drawing. :param factor: Number by which to scale the plot. ...
return TextGroup(self.text_collection)
Continue the code snippet: <|code_start|> def vis_connect(self, event_name, callback): return getattr(self.vispy_canvas.events, event_name).connect(callback) def vis_disconnect(self, event_name, callback): getattr(self.vispy_canvas.events, event_name).disconnect(callback) def zoom(self, fa...
c = Cursor(pos=np.empty((0, 2)), parent=self.vispy_canvas.view.scene)
Next line prediction: <|code_start|>## py-arduino is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License version 2 for more details. ## ## You shoul...
class Main(BasePyroMain):
Predict the next line after this snippet: <|code_start|> def save(self, *args, **kwargs): if self.pin_id is not None and len(self.pin_id.strip()) == 0: self.pin_id = None super(Pin, self).save(*args, **kwargs) # Call the "real" save() method. def __unicode__(self): if self.d...
label=default_label(pin, is_digital), enabled_in_web=True)
Here is a snippet: <|code_start|>logger = logging.getLogger(__name__) class Pin(models.Model): pin = models.PositiveIntegerField() digital = models.BooleanField() label = models.CharField(max_length=64, help_text="Descriptive text for a pin. Ej: 'Status Led'") pin_id = models.CharField(max_len...
class DjStorage(BaseStorage):
Given snippet: <|code_start|>## py-arduino is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License version 2 for more details. ## ## You should have ...
options, args, arduino = default_main(
Given snippet: <|code_start|> def validate(self): self.runner.stage() self.__execute(self.validate_sql) self.__promote() self.runner.rollback() def __execute(self, sql): self.table.stage_update() self.sql.execute(( sql, self.schema.update_table, self.s...
self.manifest = Manifest(metadata, source, schema, bucket)
Here is a snippet: <|code_start|> class BulkCopyFromS3JsonStep(PipelineStep): def __init__(self, metadata, source, schema, aws_access_key_id, aws_secret_access_key, bucket, table): self.metadata = metadata self.source = source self.schema = schema self.aws_access_ke...
self.runner = S3JsonStepRunner(metadata, schema, bucket, table)
Given the following code snippet before the placeholder: <|code_start|> class BulkCopyFromS3JsonStep(PipelineStep): def __init__(self, metadata, source, schema, aws_access_key_id, aws_secret_access_key, bucket, table): self.metadata = metadata self.source = source self.sche...
return normalize_path(self.source)
Continue the code snippet: <|code_start|> class Manifest(object): def __init__(self, metadata, source, schema, bucket): self.metadata = metadata self.source = source self.schema = schema self.bucket = bucket self.file_name = '{0}_manifest.json'.format(schema.table) s...
return normalize_path('{0}/{1}'.format(self.metadata, self.file_name))
Next line prediction: <|code_start|> 'entries': [ {'url': 's3://{0}/{1}'.format(self.bucket.name, key), 'mandatory': True} for key in keys ] }, 'updated_journal': updated_journal } def save(self): manife...
if isinstance(db_connection, Database):
Continue the code snippet: <|code_start|> class SqlStepShould(unittest.TestCase): def assert_sql(self, database, select, select_with_where): actual_select_with_where = database.execute.call_args_list[0][0] actual_select = database.execute.call_args_list[1][0] self.assertEqual(2, len(actual_...
step = SqlStep(database, select_with_where, select)
Continue the code snippet: <|code_start|> class S3JsonStepRunner(object): def __init__(self, metadata, schema, bucket, table): self.metadata = metadata self.bucket = bucket self.table = table self.schema = schema @property def schema_key(self): <|code_end|> . Use current fi...
return normalize_path(
Given the following code snippet before the placeholder: <|code_start|> @staticmethod def __validate_supported_type(column_type): types = ['SMALLINT', 'INT2', 'INTEGER', 'INT', 'INT4', 'BIGINT', 'INT8', ...
raise SchemaException(
Continue the code snippet: <|code_start|> class Command(BaseCommand): help = 'Pings configured domain checks for their current status.' def add_arguments(self, parser): parser.add_argument( '--minutes', type=int, dest='minutes', default=5, help='Time cutoff from the last chec...
for check in DomainCheck.objects.active().stale(cutoff=cutoff):
Given the following code snippet before the placeholder: <|code_start|>"""statuspage URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2...
url(r'register/$', RegistrationView.as_view(), name='register'),
Based on the snippet: <|code_start|> else: return DomainCheck.objects.none() class StatusDetail(ListView): template_name = 'domainchecks/public-status-detail.html' allow_empty = False context_object_name = 'checks' def get_queryset(self): return DomainCheck.objects.active()...
results = CheckResultFilter(self.request.GET, queryset=qs, strict=True)
Here is a snippet: <|code_start|> if domain.owner != self.request.user: raise PermissionDenied('Must be the domain owner to view this page.') return super().get_queryset() class CheckTimeline(ListView): def get_queryset(self): check = get_object_or_404( DomainCheck....
form_class = DomainForm
Given the code snippet: <|code_start|> class StatusList(ListView): template_name = 'domainchecks/status-list.html' context_object_name = 'domains' def get_queryset(self): if self.request.user.is_authenticated(): return DomainCheck.objects.active().filter( domain__owner...
domain = get_object_or_404(Domain, name=self.kwargs['domain'])
Predict the next line for this snippet: <|code_start|> class StatusList(ListView): template_name = 'domainchecks/status-list.html' context_object_name = 'domains' def get_queryset(self): if self.request.user.is_authenticated(): <|code_end|> with the help of current file imports: from django.cor...
return DomainCheck.objects.active().filter(
Using the snippet: <|code_start|> ).values('domain__name').status().order_by('domain__name') else: return DomainCheck.objects.none() class StatusDetail(ListView): template_name = 'domainchecks/public-status-detail.html' allow_empty = False context_object_name = 'checks' ...
qs = CheckResult.objects.filter(domain_check=check)
Given the following code snippet before the placeholder: <|code_start|>"""A simple demonstration of LKD to read data from a system bus using any custom driver. Here we read the BIOS_CNTL (bus = 0x00, device = 0x1F, function = 0x00, offset = 0xDC) PCI register which is in charge of protecting the SPI Flash, containing...
kdbg = LocalKernelDebugger()
Continue the code snippet: <|code_start|> # Re-activate IA32_PMC0 kdbg.write_msr(MSR_PERF_GLOBAL_CTRL, 1) # PEBS records getters def get_number_pebs_records(self, proc_nb): """Get the number of PEBS entries stored in the buffer for proc `proc_nb`""" ds_addr, ds_content = self.get...
kdbg = LocalKernelDebugger()
Next line prediction: <|code_start|> if to_string: old_output = self._output_callback self._init_string_output_callback() self.DebugControl.Execute(0, str, 0) if to_string: if old_output is None: old_output = self._standard_output_callback ...
my_idebugoutput_vtable = IDebugOutputCallbacksVtable.create_vtable(Output=callback)
Continue the code snippet: <|code_start|> windows.winproxy.DeviceIoControl(h, DU_KCALL_IOCTL, buffer, len(buffer), byref(res), ctypes.sizeof(res)) return res.value @require_upgraded_driver def do_in(self, port, size): """Perform IN instruction in kernel mode""" if size not in [1,...
windows.winproxy.DeviceIoControl(h, DU_MEMALLOC_IOCTL, buffer, len(buffer), byref(res), 4)
Given snippet: <|code_start|> FindResourceW_addr_jump = dbgengmod.DllBase + self.FindResourceW_addr_jump_offset DummyFindResourceWIAT = DummyIATEntry.create(FindResourceW_addr_jump, "kernel32.dll", "FindResourceW") # Add our driver to emulated resources resource_emulation.resource_list.a...
windows.winproxy.DeviceIoControl(h, DU_KCALL_IOCTL, buffer, len(buffer), byref(res), ctypes.sizeof(res))
Next line prediction: <|code_start|> # upgraded driver API @require_upgraded_driver def kcall(self, target, *args): """Call target in kernel mode with given arguments""" target = self.resolve_symbol(target) args = [arg if arg is not None else 0 for arg in args] buffer = struct...
windows.winproxy.DeviceIoControl(h, DU_OUT_IOCTL, buffer, len(buffer), 0, 0)
Using the snippet: <|code_start|> def _setup_name_imposture(self, dbgengmod, k32import): GetModuleFileNameW_addr_jump = dbgengmod.DllBase + self.GetModuleFileNameW_addr_jump_offset DummyGetModuleFileNameWIAT = DummyIATEntry.create(GetModuleFileNameW_addr_jump, "kernel32.dll", "GetModuleFileNameW") ...
windows.winproxy.DeviceIoControl(h, DU_IN_IOCTL, buffer, len(buffer), byref(res), ctypes.sizeof(res))
Predict the next line after this snippet: <|code_start|> self.DebugDataSpaces.Release() del self.DebugDataSpaces def current_processor(self): """:returns: The number of the processor we are currently on -- :class:`int`""" return windows.winproxy.GetCurrentProcessorNumber() def s...
return DbgEngType(module, typeid, self)
Predict the next line for this snippet: <|code_start|> # COM IID for the interface we need IID_IDebugClient_raw = 0x27fe5639, 0x8407, 0x4f47, 0x83, 0x64, 0xee, 0x11, 0x8f, 0xb0, 0x8a, 0xc8 IID_IDebugDataSpaces_raw = 0x88f7dfab, 0x3ea7, 0x4c3a, 0xae, 0xfb, 0xc4, 0xe8, 0x10, 0x61, 0x73, 0xaa IID_IDebugDataSpaces2_raw = 0...
IID_IDebugClient = get_IID_from_raw(IID_IDebugClient_raw)
Predict the next line after this snippet: <|code_start|>"""A demonstration of LKD that display all files opened by hooking nt!NtCreateFile""" if os.getcwd().endswith("example"): sys.path.append(os.path.realpath("..")) else: sys.path.append(os.path.realpath(".")) <|code_end|> using the current file's import...
kdbg = LocalKernelDebugger()
Predict the next line after this snippet: <|code_start|>"""A simple demonstration of the type exploration in LDK""" if os.getcwd().endswith("example"): sys.path.append(os.path.realpath("..")) else: sys.path.append(os.path.realpath(".")) # This demo works on 32bits kernel only because # in _KPCR fieldnames ar...
kdbg = LocalKernelDebugger()
Next line prediction: <|code_start|>"""A simple demonstration of the output possibilities of the LDK""" if os.getcwd().endswith("example"): sys.path.append(os.path.realpath("..")) else: sys.path.append(os.path.realpath(".")) # A default LKD can be quiet or not # A quiet LKD will have no output # A noisy one w...
kdbg = LocalKernelDebugger(quiet=True)