index int64 0 50.7k | project_path stringclasses 279
values | completion_path stringlengths 57 199 | signature_postion stringlengths 3 11 | class_position stringlengths 3 11 | function_name stringlengths 1 62 | class_name stringlengths 0 55 | body_position stringlengths 3 11 | body_position_with_comments stringlengths 3 11 | masked_class stringlengths 14 8.32k | masked_class_with_comment stringlengths 14 8.32k | func_body stringlengths 9 6.72k | func_body_with_comment stringlengths 9 6.72k | len_func_body int64 1 643 | len_input int64 10 2.02k | len_output int64 4 1.9k | total int64 20 2.05k | file_code stringlengths 14 442k | file_code_with_comment stringlengths 14 442k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
367 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/modules/ui_gradio_extensions.py | 47,48 | 1,63 | reload_javascript | 48,61 | 48,61 | import os
import gradio as gr
from modules import localization, shared, scripts, util
from modules.paths import script_path, data_path
def webpath(fn):
return f'file={util.truncate_path(fn)}?{os.path.getmtime(fn)}'
def javascript_html():
# Ensure localization is in `window` before scripts
head = f'<scr... | import os
import gradio as gr
from modules import localization, shared, scripts, util
from modules.paths import script_path, data_path
def webpath(fn):
return f'file={util.truncate_path(fn)}?{os.path.getmtime(fn)}'
def javascript_html():
# Ensure localization is in `window` before scripts
head = f'<scr... | js = javascript_html()
css = css_html()
def template_response(*args, **kwargs):
res = shared.GradioTemplateResponseOriginal(*args, **kwargs)
res.body = res.body.replace(b'</head>', f'{js}</head>'.encode("utf8"))
res.body = res.body.replace(b'</body>', f'{css}</body>'.encode("utf8"))... | js = javascript_html()
css = css_html()
def template_response(*args, **kwargs):
res = shared.GradioTemplateResponseOriginal(*args, **kwargs)
res.body = res.body.replace(b'</head>', f'{js}</head>'.encode("utf8"))
res.body = res.body.replace(b'</body>', f'{css}</body>'.encode("utf8"))... | 27 | 539 | 158 | 697 | import os
import gradio as gr
from modules import localization, shared, scripts, util
from modules.paths import script_path, data_path
def webpath(fn):
return f'file={util.truncate_path(fn)}?{os.path.getmtime(fn)}'
def javascript_html():
# Ensure localization is in `window` before scripts
head = f'<scr... | import os
import gradio as gr
from modules import localization, shared, scripts, util
from modules.paths import script_path, data_path
def webpath(fn):
return f'file={util.truncate_path(fn)}?{os.path.getmtime(fn)}'
def javascript_html():
# Ensure localization is in `window` before scripts
head = f'<scr... | |
370 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/modules/ui_prompt_styles.py | 21,22 | 1,124 | save_style | 22,35 | 22,35 | import gradio as gr
from modules import shared, ui_common, ui_components, styles
styles_edit_symbol = '\U0001f58c\uFE0F' # 🖌️
styles_materialize_symbol = '\U0001f4cb' # 📋
styles_copy_symbol = '\U0001f4dd' # 📝
def select_style(name):
style = shared.prompt_styles.styles.get(name)
existing = style is not... | import gradio as gr
from modules import shared, ui_common, ui_components, styles
styles_edit_symbol = '\U0001f58c\uFE0F' # 🖌️
styles_materialize_symbol = '\U0001f4cb' # 📋
styles_copy_symbol = '\U0001f4dd' # 📝
def select_style(name):
style = shared.prompt_styles.styles.get(name)
existing = style is not... | if not name:
return gr.update(visible=False)
existing_style = shared.prompt_styles.styles.get(name)
path = existing_style.path if existing_style is not None else None
style = styles.PromptStyle(name, prompt, negative_prompt, path)
shared.prompt_styles.styles[style.name] = style
shared.... | if not name:
return gr.update(visible=False)
existing_style = shared.prompt_styles.styles.get(name)
path = existing_style.path if existing_style is not None else None
style = styles.PromptStyle(name, prompt, negative_prompt, path)
shared.prompt_styles.styles[style.name] = style
shared.... | 30 | 1,753 | 134 | 1,887 | import gradio as gr
from modules import shared, ui_common, ui_components, styles
styles_edit_symbol = '\U0001f58c\uFE0F' # 🖌️
styles_materialize_symbol = '\U0001f4cb' # 📋
styles_copy_symbol = '\U0001f4dd' # 📝
def select_style(name):
style = shared.prompt_styles.styles.get(name)
existing = style is not... | import gradio as gr
from modules import shared, ui_common, ui_components, styles
styles_edit_symbol = '\U0001f58c\uFE0F' # 🖌️
styles_materialize_symbol = '\U0001f4cb' # 📋
styles_copy_symbol = '\U0001f4dd' # 📝
def select_style(name):
style = shared.prompt_styles.styles.get(name)
existing = style is not... | |
371 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/modules/ui_prompt_styles.py | 117,118 | 56,124 | setup_apply_button | UiPromptStyles | 118,124 | 118,124 | class UiPromptStyles:
def __init__(self, tabname, main_ui_prompt, main_ui_negative_prompt):
self.tabname = tabname
self.main_ui_prompt = main_ui_prompt
self.main_ui_negative_prompt = main_ui_negative_prompt
with gr.Row(elem_id=f"{tabname}_styles_row"):
self.dropdown = gr... | class UiPromptStyles:
def __init__(self, tabname, main_ui_prompt, main_ui_negative_prompt):
self.tabname = tabname
self.main_ui_prompt = main_ui_prompt
self.main_ui_negative_prompt = main_ui_negative_prompt
with gr.Row(elem_id=f"{tabname}_styles_row"):
self.dropdown = gr... | button.click(
fn=materialize_styles,
inputs=[self.main_ui_prompt, self.main_ui_negative_prompt, self.dropdown],
outputs=[self.main_ui_prompt, self.main_ui_negative_prompt, self.dropdown],
show_progress=False,
).then(fn=None, _js="function(){update_"+self.t... | button.click(
fn=materialize_styles,
inputs=[self.main_ui_prompt, self.main_ui_negative_prompt, self.dropdown],
outputs=[self.main_ui_prompt, self.main_ui_negative_prompt, self.dropdown],
show_progress=False,
).then(fn=None, _js="function(){update_"+self.t... | 13 | 1,188 | 126 | 1,314 | import gradio as gr
from modules import shared, ui_common, ui_components, styles
styles_edit_symbol = '\U0001f58c\uFE0F' # 🖌️
styles_materialize_symbol = '\U0001f4cb' # 📋
styles_copy_symbol = '\U0001f4dd' # 📝
def select_style(name):
style = shared.prompt_styles.styles.get(name)
existing = style is not... | import gradio as gr
from modules import shared, ui_common, ui_components, styles
styles_edit_symbol = '\U0001f58c\uFE0F' # 🖌️
styles_materialize_symbol = '\U0001f4cb' # 📋
styles_copy_symbol = '\U0001f4dd' # 📝
def select_style(name):
style = shared.prompt_styles.styles.get(name)
existing = style is not... |
375 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/modules/upscaler.py | 54,55 | 14,89 | upscale | Upscaler | 55,78 | 55,78 | class Upscaler:
name = None
model_path = None
model_name = None
model_url = None
enable = True
filter = None
model = None
user_path = None
scalers: list
tile = True
def __init__(self, create_dirs=False):
self.mod_pad_h = None
self.tile_size = modules.shared.o... | class Upscaler:
name = None
model_path = None
model_name = None
model_url = None
enable = True
filter = None
model = None
user_path = None
scalers: list
tile = True
def __init__(self, create_dirs=False):
self.mod_pad_h = None
self.tile_size = modules.shared.o... | self.scale = scale
dest_w = int((img.width * scale) // 8 * 8)
dest_h = int((img.height * scale) // 8 * 8)
for _ in range(3):
if img.width >= dest_w and img.height >= dest_h and scale != 1:
break
if shared.state.interrupted:
break
... | self.scale = scale
dest_w = int((img.width * scale) // 8 * 8)
dest_h = int((img.height * scale) // 8 * 8)
for _ in range(3):
if img.width >= dest_w and img.height >= dest_h and scale != 1:
break
if shared.state.interrupted:
break
... | 70 | 531 | 230 | 761 | import os
from abc import abstractmethod
import PIL
from PIL import Image
import modules.shared
from modules import modelloader, shared
LANCZOS = (Image.Resampling.LANCZOS if hasattr(Image, 'Resampling') else Image.LANCZOS)
NEAREST = (Image.Resampling.NEAREST if hasattr(Image, 'Resampling') else Image.NEAREST)
cla... | import os
from abc import abstractmethod
import PIL
from PIL import Image
import modules.shared
from modules import modelloader, shared
LANCZOS = (Image.Resampling.LANCZOS if hasattr(Image, 'Resampling') else Image.LANCZOS)
NEAREST = (Image.Resampling.NEAREST if hasattr(Image, 'Resampling') else Image.NEAREST)
cla... |
376 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/modules/upscaler.py | 126,127 | 123,138 | do_upscale | UpscalerLanczos | 127,129 | 127,129 | class UpscalerLanczos(Upscaler):
scalers = []
def do_upscale(self, img, selected_model=None):
FILL_FUNC_BODY def load_model(self, _):
pass
def __init__(self, dirname=None):
super().__init__(False)
self.name = "Lanczos"
self.scalers = [UpscalerData("Lanczos", None, self)]... | class UpscalerLanczos(Upscaler):
scalers = []
def do_upscale(self, img, selected_model=None):
FILL_FUNC_BODY def load_model(self, _):
pass
def __init__(self, dirname=None):
super().__init__(False)
self.name = "Lanczos"
self.scalers = [UpscalerData("Lanczos", None, self)]... | return img.resize((int(img.width * self.scale), int(img.height * self.scale)), resample=LANCZOS)
| return img.resize((int(img.width * self.scale), int(img.height * self.scale)), resample=LANCZOS)
| 8 | 125 | 39 | 164 | import os
from abc import abstractmethod
import PIL
from PIL import Image
import modules.shared
from modules import modelloader, shared
LANCZOS = (Image.Resampling.LANCZOS if hasattr(Image, 'Resampling') else Image.LANCZOS)
NEAREST = (Image.Resampling.NEAREST if hasattr(Image, 'Resampling') else Image.NEAREST)
cla... | import os
from abc import abstractmethod
import PIL
from PIL import Image
import modules.shared
from modules import modelloader, shared
LANCZOS = (Image.Resampling.LANCZOS if hasattr(Image, 'Resampling') else Image.LANCZOS)
NEAREST = (Image.Resampling.NEAREST if hasattr(Image, 'Resampling') else Image.NEAREST)
cla... |
377 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/modules/upscaler.py | 141,142 | 138,151 | do_upscale | UpscalerNearest | 142,144 | 142,144 | class UpscalerNearest(Upscaler):
scalers = []
def do_upscale(self, img, selected_model=None):
FILL_FUNC_BODY def load_model(self, _):
pass
def __init__(self, dirname=None):
super().__init__(False)
self.name = "Nearest"
self.scalers = [UpscalerData("Nearest", None, self)]... | class UpscalerNearest(Upscaler):
scalers = []
def do_upscale(self, img, selected_model=None):
FILL_FUNC_BODY def load_model(self, _):
pass
def __init__(self, dirname=None):
super().__init__(False)
self.name = "Nearest"
self.scalers = [UpscalerData("Nearest", None, self)]... | return img.resize((int(img.width * self.scale), int(img.height * self.scale)), resample=NEAREST)
| return img.resize((int(img.width * self.scale), int(img.height * self.scale)), resample=NEAREST)
| 8 | 117 | 37 | 154 | import os
from abc import abstractmethod
import PIL
from PIL import Image
import modules.shared
from modules import modelloader, shared
LANCZOS = (Image.Resampling.LANCZOS if hasattr(Image, 'Resampling') else Image.LANCZOS)
NEAREST = (Image.Resampling.NEAREST if hasattr(Image, 'Resampling') else Image.NEAREST)
cla... | import os
from abc import abstractmethod
import PIL
from PIL import Image
import modules.shared
from modules import modelloader, shared
LANCZOS = (Image.Resampling.LANCZOS if hasattr(Image, 'Resampling') else Image.LANCZOS)
NEAREST = (Image.Resampling.NEAREST if hasattr(Image, 'Resampling') else Image.NEAREST)
cla... |
378 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/modules/upscaler.py | 115,116 | 108,123 | do_upscale | UpscalerNone | 116,118 | 116,118 | class UpscalerNone(Upscaler):
name = "None"
scalers = []
def load_model(self, path):
pass
def do_upscale(self, img, selected_model=None):
FILL_FUNC_BODY def __init__(self, dirname=None):
super().__init__(False)
self.scalers = [UpscalerData("None", None, self)]
| class UpscalerNone(Upscaler):
name = "None"
scalers = []
def load_model(self, path):
pass
def do_upscale(self, img, selected_model=None):
FILL_FUNC_BODY def __init__(self, dirname=None):
super().__init__(False)
self.scalers = [UpscalerData("None", None, self)]
| return img
| return img
| 2 | 114 | 7 | 121 | import os
from abc import abstractmethod
import PIL
from PIL import Image
import modules.shared
from modules import modelloader, shared
LANCZOS = (Image.Resampling.LANCZOS if hasattr(Image, 'Resampling') else Image.LANCZOS)
NEAREST = (Image.Resampling.NEAREST if hasattr(Image, 'Resampling') else Image.NEAREST)
cla... | import os
from abc import abstractmethod
import PIL
from PIL import Image
import modules.shared
from modules import modelloader, shared
LANCZOS = (Image.Resampling.LANCZOS if hasattr(Image, 'Resampling') else Image.LANCZOS)
NEAREST = (Image.Resampling.NEAREST if hasattr(Image, 'Resampling') else Image.NEAREST)
cla... |
380 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/modules/xlmr.py | 82,96 | 27,138 | forward | BertSeriesModelWithTransformation | 96,138 | 96,138 | class BertSeriesModelWithTransformation(BertPreTrainedModel):
_keys_to_ignore_on_load_unexpected = [r"pooler"]
_keys_to_ignore_on_load_missing = [r"position_ids", r"predictions.decoder.bias"]
config_class = BertSeriesConfig
def __init__(self, config=None, **kargs):
# modify initialization for ... | class BertSeriesModelWithTransformation(BertPreTrainedModel):
_keys_to_ignore_on_load_unexpected = [r"pooler"]
_keys_to_ignore_on_load_missing = [r"position_ids", r"predictions.decoder.bias"]
config_class = BertSeriesConfig
def __init__(self, config=None, **kargs):
# modify initialization for ... | r"""
"""
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
outputs = self.roberta(
input_ids=input_ids,
attention_mask=attention_mask,
token_type_ids=token_type_ids,
position_ids=position_ids,
... | r"""
"""
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
outputs = self.roberta(
input_ids=input_ids,
attention_mask=attention_mask,
token_type_ids=token_type_ids,
position_ids=position_ids,
... | 62 | 893 | 419 | 1,312 | from transformers import BertPreTrainedModel, BertConfig
import torch.nn as nn
import torch
from transformers.models.xlm_roberta.configuration_xlm_roberta import XLMRobertaConfig
from transformers import XLMRobertaModel,XLMRobertaTokenizer
from typing import Optional
from modules import torch_utils
class BertSeriesC... | from transformers import BertPreTrainedModel, BertConfig
import torch.nn as nn
import torch
from transformers.models.xlm_roberta.configuration_xlm_roberta import XLMRobertaConfig
from transformers import XLMRobertaModel,XLMRobertaTokenizer
from typing import Optional
from modules import torch_utils
class BertSeriesC... |
381 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/modules/xlmr_m18.py | 72,73 | 26,164 | encode | BertSeriesModelWithTransformation | 73,87 | 73,87 | class BertSeriesModelWithTransformation(BertPreTrainedModel):
_keys_to_ignore_on_load_unexpected = [r"pooler"]
_keys_to_ignore_on_load_missing = [r"position_ids", r"predictions.decoder.bias"]
config_class = BertSeriesConfig
def __init__(self, config=None, **kargs):
# modify initialization for ... | class BertSeriesModelWithTransformation(BertPreTrainedModel):
_keys_to_ignore_on_load_unexpected = [r"pooler"]
_keys_to_ignore_on_load_missing = [r"position_ids", r"predictions.decoder.bias"]
config_class = BertSeriesConfig
def __init__(self, config=None, **kargs):
# modify initialization for ... | device = torch_utils.get_param(self).device
text = self.tokenizer(c,
truncation=True,
max_length=77,
return_length=False,
return_overflowing_tokens=False,
padding="max_length",
... | device = torch_utils.get_param(self).device
text = self.tokenizer(c,
truncation=True,
max_length=77,
return_length=False,
return_overflowing_tokens=False,
padding="max_length",
... | 24 | 1,451 | 169 | 1,620 | from transformers import BertPreTrainedModel,BertConfig
import torch.nn as nn
import torch
from transformers.models.xlm_roberta.configuration_xlm_roberta import XLMRobertaConfig
from transformers import XLMRobertaModel,XLMRobertaTokenizer
from typing import Optional
from modules import torch_utils
class BertSeriesCon... | from transformers import BertPreTrainedModel,BertConfig
import torch.nn as nn
import torch
from transformers.models.xlm_roberta.configuration_xlm_roberta import XLMRobertaConfig
from transformers import XLMRobertaModel,XLMRobertaTokenizer
from typing import Optional
from modules import torch_utils
class BertSeriesCon... |
382 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/scripts/custom_code.py | 10,11 | 1,91 | convertExpr2Expression | 11,18 | 11,18 | import modules.scripts as scripts
import gradio as gr
import ast
import copy
from modules.processing import Processed
from modules.shared import cmd_opts
def convertExpr2Expression(expr):
FILL_FUNC_BODYdef exec_with_return(code, module):
"""
like exec() but can return values
https://stackoverflow.com/a/5... | import modules.scripts as scripts
import gradio as gr
import ast
import copy
from modules.processing import Processed
from modules.shared import cmd_opts
def convertExpr2Expression(expr):
FILL_FUNC_BODYdef exec_with_return(code, module):
"""
like exec() but can return values
https://stackoverflow.com/a/5... | expr.lineno = 0
expr.col_offset = 0
result = ast.Expression(expr.value, lineno=0, col_offset = 0)
return result
| expr.lineno = 0
expr.col_offset = 0
result = ast.Expression(expr.value, lineno=0, col_offset = 0)
return result
| 15 | 773 | 56 | 829 | import modules.scripts as scripts
import gradio as gr
import ast
import copy
from modules.processing import Processed
from modules.shared import cmd_opts
def convertExpr2Expression(expr):
FILL_FUNC_BODYdef exec_with_return(code, module):
"""
like exec() but can return values
https://stackoverflow.com/a/5... | import modules.scripts as scripts
import gradio as gr
import ast
import copy
from modules.processing import Processed
from modules.shared import cmd_opts
def convertExpr2Expression(expr):
FILL_FUNC_BODYdef exec_with_return(code, module):
"""
like exec() but can return values
https://stackoverflow.com/a/5... | |
383 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/scripts/custom_code.py | 63,64 | 38,91 | run | Script | 64,91 | 64,91 | class Script(scripts.Script):
def title(self):
return "Custom code"
def show(self, is_img2img):
return cmd_opts.allow_code
def ui(self, is_img2img):
example = """from modules.processing import process_images
p.width = 768
p.height = 768
p.batch_size = 2
p.steps = 10
return proce... | class Script(scripts.Script):
def title(self):
return "Custom code"
def show(self, is_img2img):
return cmd_opts.allow_code
def ui(self, is_img2img):
example = """from modules.processing import process_images
p.width = 768
p.height = 768
p.batch_size = 2
p.steps = 10
return proce... | assert cmd_opts.allow_code, '--allow-code option must be enabled'
display_result_data = [[], -1, ""]
def display(imgs, s=display_result_data[1], i=display_result_data[2]):
display_result_data[0] = imgs
display_result_data[1] = s
display_result_data[2] = i
... | assert cmd_opts.allow_code, '--allow-code option must be enabled'
display_result_data = [[], -1, ""]
def display(imgs, s=display_result_data[1], i=display_result_data[2]):
display_result_data[0] = imgs
display_result_data[1] = s
display_result_data[2] = i
... | 67 | 233 | 285 | 518 | import modules.scripts as scripts
import gradio as gr
import ast
import copy
from modules.processing import Processed
from modules.shared import cmd_opts
def convertExpr2Expression(expr):
expr.lineno = 0
expr.col_offset = 0
result = ast.Expression(expr.value, lineno=0, col_offset = 0)
return result
... | import modules.scripts as scripts
import gradio as gr
import ast
import copy
from modules.processing import Processed
from modules.shared import cmd_opts
def convertExpr2Expression(expr):
expr.lineno = 0
expr.col_offset = 0
result = ast.Expression(expr.value, lineno=0, col_offset = 0)
return result
... |
385 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/scripts/img2imgalt.py | 131,132 | 121,219 | ui | Script | 132,160 | 132,160 | class Script(scripts.Script):
def __init__(self):
self.cache = None
def title(self):
return "img2img alternative test"
def show(self, is_img2img):
return is_img2img
def ui(self, is_img2img):
FILL_FUNC_BODY def run(self, p, _, override_sampler, override_prompt, original_prom... | class Script(scripts.Script):
def __init__(self):
self.cache = None
def title(self):
return "img2img alternative test"
def show(self, is_img2img):
return is_img2img
def ui(self, is_img2img):
FILL_FUNC_BODY def run(self, p, _, override_sampler, override_prompt, original_prom... | info = gr.Markdown('''
* `CFG Scale` should be 2 or lower.
''')
override_sampler = gr.Checkbox(label="Override `Sampling method` to Euler?(this method is built for it)", value=True, elem_id=self.elem_id("override_sampler"))
override_prompt = gr.Checkbox(label="Override `prompt`... | info = gr.Markdown('''
* `CFG Scale` should be 2 or lower.
''')
override_sampler = gr.Checkbox(label="Override `Sampling method` to Euler?(this method is built for it)", value=True, elem_id=self.elem_id("override_sampler"))
override_prompt = gr.Checkbox(label="Override `prompt`... | 129 | 1,070 | 622 | 1,692 | from collections import namedtuple
import numpy as np
from tqdm import trange
import modules.scripts as scripts
import gradio as gr
from modules import processing, shared, sd_samplers, sd_samplers_common
import torch
import k_diffusion as K
def find_noise_for_image(p, cond, uncond, cfg_scale, steps):
x = p.ini... | from collections import namedtuple
import numpy as np
from tqdm import trange
import modules.scripts as scripts
import gradio as gr
from modules import processing, shared, sd_samplers, sd_samplers_common
import torch
import k_diffusion as K
def find_noise_for_image(p, cond, uncond, cfg_scale, steps):
x = p.ini... |
386 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/scripts/loopback.py | 25,26 | 10,141 | run | Script | 26,141 | 26,141 | class Script(scripts.Script):
def title(self):
return "Loopback"
def show(self, is_img2img):
return is_img2img
def ui(self, is_img2img):
loops = gr.Slider(minimum=1, maximum=32, step=1, label='Loops', value=4, elem_id=self.elem_id("loops"))
final_denoising_strength = gr.Sli... | class Script(scripts.Script):
def title(self):
return "Loopback"
def show(self, is_img2img):
return is_img2img
def ui(self, is_img2img):
loops = gr.Slider(minimum=1, maximum=32, step=1, label='Loops', value=4, elem_id=self.elem_id("loops"))
final_denoising_strength = gr.Sli... | processing.fix_seed(p)
batch_count = p.n_iter
p.extra_generation_params = {
"Final denoising strength": final_denoising_strength,
"Denoising curve": denoising_curve
}
p.batch_size = 1
p.n_iter = 1
info = None
initial_seed = None
... | processing.fix_seed(p)
batch_count = p.n_iter
p.extra_generation_params = {
"Final denoising strength": final_denoising_strength,
"Denoising curve": denoising_curve
}
p.batch_size = 1
p.n_iter = 1
info = None
initial_seed = None
... | 316 | 331 | 1,262 | 1,593 | import math
import gradio as gr
import modules.scripts as scripts
from modules import deepbooru, images, processing, shared
from modules.processing import Processed
from modules.shared import opts, state
class Script(scripts.Script):
def title(self):
return "Loopback"
def show(self, is_img2img):
... | import math
import gradio as gr
import modules.scripts as scripts
from modules import deepbooru, images, processing, shared
from modules.processing import Processed
from modules.shared import opts, state
class Script(scripts.Script):
def title(self):
return "Loopback"
def show(self, is_img2img):
... |
389 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/scripts/poor_mans_outpainting.py | 30,31 | 12,147 | run | Script | 31,147 | 31,147 | class Script(scripts.Script):
def title(self):
return "Poor man's outpainting"
def show(self, is_img2img):
return is_img2img
def ui(self, is_img2img):
if not is_img2img:
return None
pixels = gr.Slider(label="Pixels to expand", minimum=8, maximum=256, step=8, va... | class Script(scripts.Script):
def title(self):
return "Poor man's outpainting"
def show(self, is_img2img):
return is_img2img
def ui(self, is_img2img):
if not is_img2img:
return None
pixels = gr.Slider(label="Pixels to expand", minimum=8, maximum=256, step=8, va... | initial_seed = None
initial_info = None
p.mask_blur = mask_blur * 2
p.inpainting_fill = inpainting_fill
p.inpaint_full_res = False
left = pixels if "left" in direction else 0
right = pixels if "right" in direction else 0
up = pixels if "up" in direction ... | initial_seed = None
initial_info = None
p.mask_blur = mask_blur * 2
p.inpainting_fill = inpainting_fill
p.inpaint_full_res = False
left = pixels if "left" in direction else 0
right = pixels if "right" in direction else 0
up = pixels if "up" in direction ... | 478 | 366 | 1,571 | 1,937 | import math
import modules.scripts as scripts
import gradio as gr
from PIL import Image, ImageDraw
from modules import images, devices
from modules.processing import Processed, process_images
from modules.shared import opts, state
class Script(scripts.Script):
def title(self):
return "Poor man's outpain... | import math
import modules.scripts as scripts
import gradio as gr
from PIL import Image, ImageDraw
from modules import images, devices
from modules.processing import Processed, process_images
from modules.shared import opts, state
class Script(scripts.Script):
def title(self):
return "Poor man's outpain... |
390 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/scripts/postprocessing_codeformer.py | 24,25 | 8,37 | process | ScriptPostprocessingCodeFormer | 25,37 | 25,37 | class ScriptPostprocessingCodeFormer(scripts_postprocessing.ScriptPostprocessing):
name = "CodeFormer"
order = 3000
def ui(self):
with ui_components.InputAccordion(False, label="CodeFormer") as enable:
with gr.Row():
codeformer_visibility = gr.Slider(minimum=0.0, maximum... | class ScriptPostprocessingCodeFormer(scripts_postprocessing.ScriptPostprocessing):
name = "CodeFormer"
order = 3000
def ui(self):
with ui_components.InputAccordion(False, label="CodeFormer") as enable:
with gr.Row():
codeformer_visibility = gr.Slider(minimum=0.0, maximum... | if codeformer_visibility == 0 or not enable:
return
restored_img = codeformer_model.codeformer.restore(np.array(pp.image.convert("RGB"), dtype=np.uint8), w=codeformer_weight)
res = Image.fromarray(restored_img)
if codeformer_visibility < 1.0:
res = Image.blend(p... | if codeformer_visibility == 0 or not enable:
return
restored_img = codeformer_model.codeformer.restore(np.array(pp.image.convert("RGB"), dtype=np.uint8), w=codeformer_weight)
res = Image.fromarray(restored_img)
if codeformer_visibility < 1.0:
res = Image.blend(p... | 38 | 284 | 177 | 461 | from PIL import Image
import numpy as np
from modules import scripts_postprocessing, codeformer_model, ui_components
import gradio as gr
class ScriptPostprocessingCodeFormer(scripts_postprocessing.ScriptPostprocessing):
name = "CodeFormer"
order = 3000
def ui(self):
with ui_components.InputAccor... | from PIL import Image
import numpy as np
from modules import scripts_postprocessing, codeformer_model, ui_components
import gradio as gr
class ScriptPostprocessingCodeFormer(scripts_postprocessing.ScriptPostprocessing):
name = "CodeFormer"
order = 3000
def ui(self):
with ui_components.InputAccor... |
391 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/scripts/postprocessing_gfpgan.py | 21,22 | 8,33 | process | ScriptPostprocessingGfpGan | 22,33 | 22,33 | class ScriptPostprocessingGfpGan(scripts_postprocessing.ScriptPostprocessing):
name = "GFPGAN"
order = 2000
def ui(self):
with ui_components.InputAccordion(False, label="GFPGAN") as enable:
gfpgan_visibility = gr.Slider(minimum=0.0, maximum=1.0, step=0.001, label="Visibility", value=1.0... | class ScriptPostprocessingGfpGan(scripts_postprocessing.ScriptPostprocessing):
name = "GFPGAN"
order = 2000
def ui(self):
with ui_components.InputAccordion(False, label="GFPGAN") as enable:
gfpgan_visibility = gr.Slider(minimum=0.0, maximum=1.0, step=0.001, label="Visibility", value=1.0... | if gfpgan_visibility == 0 or not enable:
return
restored_img = gfpgan_model.gfpgan_fix_faces(np.array(pp.image.convert("RGB"), dtype=np.uint8))
res = Image.fromarray(restored_img)
if gfpgan_visibility < 1.0:
res = Image.blend(pp.image, res, gfpgan_visibility)
... | if gfpgan_visibility == 0 or not enable:
return
restored_img = gfpgan_model.gfpgan_fix_faces(np.array(pp.image.convert("RGB"), dtype=np.uint8))
res = Image.fromarray(restored_img)
if gfpgan_visibility < 1.0:
res = Image.blend(pp.image, res, gfpgan_visibility)
... | 32 | 200 | 154 | 354 | from PIL import Image
import numpy as np
from modules import scripts_postprocessing, gfpgan_model, ui_components
import gradio as gr
class ScriptPostprocessingGfpGan(scripts_postprocessing.ScriptPostprocessing):
name = "GFPGAN"
order = 2000
def ui(self):
with ui_components.InputAccordion(False, ... | from PIL import Image
import numpy as np
from modules import scripts_postprocessing, gfpgan_model, ui_components
import gradio as gr
class ScriptPostprocessingGfpGan(scripts_postprocessing.ScriptPostprocessing):
name = "GFPGAN"
order = 2000
def ui(self):
with ui_components.InputAccordion(False, ... |
394 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/scripts/postprocessing_upscale.py | 187,188 | 169,196 | process | ScriptPostprocessingUpscaleSimple | 188,196 | 188,196 | class ScriptPostprocessingUpscaleSimple(ScriptPostprocessingUpscale):
name = "Simple Upscale"
order = 900
def ui(self):
with FormRow():
upscaler_name = gr.Dropdown(label='Upscaler', choices=[x.name for x in shared.sd_upscalers], value=shared.sd_upscalers[0].name)
upscale_by ... | class ScriptPostprocessingUpscaleSimple(ScriptPostprocessingUpscale):
name = "Simple Upscale"
order = 900
def ui(self):
with FormRow():
upscaler_name = gr.Dropdown(label='Upscaler', choices=[x.name for x in shared.sd_upscalers], value=shared.sd_upscalers[0].name)
upscale_by ... | if upscaler_name is None or upscaler_name == "None":
return
upscaler1 = next(iter([x for x in shared.sd_upscalers if x.name == upscaler_name]), None)
assert upscaler1, f'could not find upscaler named {upscaler_name}'
pp.image = self.upscale(pp.image, pp.info, upscaler1, 0, ... | if upscaler_name is None or upscaler_name == "None":
return
upscaler1 = next(iter([x for x in shared.sd_upscalers if x.name == upscaler_name]), None)
assert upscaler1, f'could not find upscaler named {upscaler_name}'
pp.image = self.upscale(pp.image, pp.info, upscaler1, 0, ... | 44 | 313 | 155 | 468 | import re
from PIL import Image
import numpy as np
from modules import scripts_postprocessing, shared
import gradio as gr
from modules.ui_components import FormRow, ToolButton, InputAccordion
from modules.ui import switch_values_symbol
upscale_cache = {}
def limit_size_by_one_dimention(w, h, limit):
if h > w ... | import re
from PIL import Image
import numpy as np
from modules import scripts_postprocessing, shared
import gradio as gr
from modules.ui_components import FormRow, ToolButton, InputAccordion
from modules.ui import switch_values_symbol
upscale_cache = {}
def limit_size_by_one_dimention(w, h, limit):
if h > w ... |
395 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/scripts/prompt_matrix.py | 12,13 | 1,109 | draw_xy_grid | 13,40 | 13,40 | import math
import modules.scripts as scripts
import gradio as gr
from modules import images
from modules.processing import process_images
from modules.shared import opts, state
import modules.sd_samplers
def draw_xy_grid(xs, ys, x_label, y_label, cell):
FILL_FUNC_BODYclass Script(scripts.Script):
def title(sel... | import math
import modules.scripts as scripts
import gradio as gr
from modules import images
from modules.processing import process_images
from modules.shared import opts, state
import modules.sd_samplers
def draw_xy_grid(xs, ys, x_label, y_label, cell):
FILL_FUNC_BODYclass Script(scripts.Script):
def title(sel... | res = []
ver_texts = [[images.GridAnnotation(y_label(y))] for y in ys]
hor_texts = [[images.GridAnnotation(x_label(x))] for x in xs]
first_processed = None
state.job_count = len(xs) * len(ys)
for iy, y in enumerate(ys):
for ix, x in enumerate(xs):
state.job = f"{ix + iy *... | res = []
ver_texts = [[images.GridAnnotation(y_label(y))] for y in ys]
hor_texts = [[images.GridAnnotation(x_label(x))] for x in xs]
first_processed = None
state.job_count = len(xs) * len(ys)
for iy, y in enumerate(ys):
for ix, x in enumerate(xs):
state.job = f"{ix + iy *... | 77 | 1,247 | 295 | 1,542 | import math
import modules.scripts as scripts
import gradio as gr
from modules import images
from modules.processing import process_images
from modules.shared import opts, state
import modules.sd_samplers
def draw_xy_grid(xs, ys, x_label, y_label, cell):
FILL_FUNC_BODYclass Script(scripts.Script):
def title(sel... | import math
import modules.scripts as scripts
import gradio as gr
from modules import images
from modules.processing import process_images
from modules.shared import opts, state
import modules.sd_samplers
def draw_xy_grid(xs, ys, x_label, y_label, cell):
FILL_FUNC_BODYclass Script(scripts.Script):
def title(sel... | |
396 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/scripts/prompt_matrix.py | 44,45 | 40,109 | ui | Script | 45,58 | 45,58 | class Script(scripts.Script):
def title(self):
return "Prompt matrix"
def ui(self, is_img2img):
FILL_FUNC_BODY def run(self, p, put_at_start, different_seeds, prompt_type, variations_delimiter, margin_size):
modules.processing.fix_seed(p)
# Raise error if promp type is not positive o... | class Script(scripts.Script):
def title(self):
return "Prompt matrix"
def ui(self, is_img2img):
FILL_FUNC_BODY def run(self, p, put_at_start, different_seeds, prompt_type, variations_delimiter, margin_size):
modules.processing.fix_seed(p)
# Raise error if promp type is not positive o... | gr.HTML('<br />')
with gr.Row():
with gr.Column():
put_at_start = gr.Checkbox(label='Put variable parts at start of prompt', value=False, elem_id=self.elem_id("put_at_start"))
different_seeds = gr.Checkbox(label='Use different seed for each picture', value=Fal... | gr.HTML('<br />')
with gr.Row():
with gr.Column():
put_at_start = gr.Checkbox(label='Put variable parts at start of prompt', value=False, elem_id=self.elem_id("put_at_start"))
different_seeds = gr.Checkbox(label='Use different seed for each picture', value=Fal... | 64 | 872 | 313 | 1,185 | import math
import modules.scripts as scripts
import gradio as gr
from modules import images
from modules.processing import process_images
from modules.shared import opts, state
import modules.sd_samplers
def draw_xy_grid(xs, ys, x_label, y_label, cell):
res = []
ver_texts = [[images.GridAnnotation(y_label... | import math
import modules.scripts as scripts
import gradio as gr
from modules import images
from modules.processing import process_images
from modules.shared import opts, state
import modules.sd_samplers
def draw_xy_grid(xs, ys, x_label, y_label, cell):
res = []
ver_texts = [[images.GridAnnotation(y_label... |
398 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/scripts/prompts_from_file.py | 130,131 | 110,192 | run | Script | 131,192 | 131,192 | class Script(scripts.Script):
def title(self):
return "Prompts from file or textbox"
def ui(self, is_img2img):
checkbox_iterate = gr.Checkbox(label="Iterate seed every line", value=False, elem_id=self.elem_id("checkbox_iterate"))
checkbox_iterate_batch = gr.Checkbox(label="Use same rand... | class Script(scripts.Script):
def title(self):
return "Prompts from file or textbox"
def ui(self, is_img2img):
checkbox_iterate = gr.Checkbox(label="Iterate seed every line", value=False, elem_id=self.elem_id("checkbox_iterate"))
checkbox_iterate_batch = gr.Checkbox(label="Use same rand... | lines = [x for x in (x.strip() for x in prompt_txt.splitlines()) if x]
p.do_not_save_grid = True
job_count = 0
jobs = []
for line in lines:
if "--" in line:
try:
args = cmdargs(line)
except Exception:
... | lines = [x for x in (x.strip() for x in prompt_txt.splitlines()) if x]
p.do_not_save_grid = True
job_count = 0
jobs = []
for line in lines:
if "--" in line:
try:
args = cmdargs(line)
except Exception:
... | 196 | 486 | 732 | 1,218 | import copy
import random
import shlex
import modules.scripts as scripts
import gradio as gr
from modules import sd_samplers, errors, sd_models
from modules.processing import Processed, process_images
from modules.shared import state
def process_model_tag(tag):
info = sd_models.get_closet_checkpoint_match(tag)
... | import copy
import random
import shlex
import modules.scripts as scripts
import gradio as gr
from modules import sd_samplers, errors, sd_models
from modules.processing import Processed, process_images
from modules.shared import state
def process_model_tag(tag):
info = sd_models.get_closet_checkpoint_match(tag)
... |
399 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/scripts/sd_upscale.py | 27,28 | 12,102 | run | Script | 28,102 | 28,102 | class Script(scripts.Script):
def title(self):
return "SD upscale"
def show(self, is_img2img):
return is_img2img
def ui(self, is_img2img):
info = gr.HTML("<p style=\"margin-bottom:0.75em\">Will upscale the image by the selected scale factor; use width and height sliders to set tile... | class Script(scripts.Script):
def title(self):
return "SD upscale"
def show(self, is_img2img):
return is_img2img
def ui(self, is_img2img):
info = gr.HTML("<p style=\"margin-bottom:0.75em\">Will upscale the image by the selected scale factor; use width and height sliders to set tile... | if isinstance(upscaler_index, str):
upscaler_index = [x.name.lower() for x in shared.sd_upscalers].index(upscaler_index.lower())
processing.fix_seed(p)
upscaler = shared.sd_upscalers[upscaler_index]
p.extra_generation_params["SD upscale overlap"] = overlap
p.extra_ge... | if isinstance(upscaler_index, str):
upscaler_index = [x.name.lower() for x in shared.sd_upscalers].index(upscaler_index.lower())
processing.fix_seed(p)
upscaler = shared.sd_upscalers[upscaler_index]
p.extra_generation_params["SD upscale overlap"] = overlap
p.extra_ge... | 230 | 339 | 929 | 1,268 | import math
import modules.scripts as scripts
import gradio as gr
from PIL import Image
from modules import processing, shared, images, devices
from modules.processing import Processed
from modules.shared import opts, state
class Script(scripts.Script):
def title(self):
return "SD upscale"
def show... | import math
import modules.scripts as scripts
import gradio as gr
from PIL import Image
from modules import processing, shared, images, devices
from modules.processing import Processed
from modules.shared import opts, state
class Script(scripts.Script):
def title(self):
return "SD upscale"
def show... |
400 | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui | /home/hieuvd/dung_repo/raw/stars_01/AUTOMATIC1111_stable-diffusion-webui/stable-diffusion-webui/webui.py | 48,49 | 1,163 | webui | 49,156 | 49,156 | from __future__ import annotations
import os
import time
from modules import timer
from modules import initialize_util
from modules import initialize
startup_timer = timer.startup_timer
startup_timer.record("launcher")
initialize.imports()
initialize.check_versions()
def create_api(app):
from modules.api.api... | from __future__ import annotations
import os
import time
from modules import timer
from modules import initialize_util
from modules import initialize
startup_timer = timer.startup_timer
startup_timer.record("launcher")
initialize.imports()
initialize.check_versions()
def create_api(app):
from modules.api.api... | from modules.shared_cmd_options import cmd_opts
launch_api = cmd_opts.api
initialize.initialize()
from modules import shared, ui_tempdir, script_callbacks, ui, progress, ui_extra_networks
while 1:
if shared.opts.clean_temp_dir_at_start:
ui_tempdir.cleanup_tmpdr()
s... | from modules.shared_cmd_options import cmd_opts
launch_api = cmd_opts.api
initialize.initialize()
from modules import shared, ui_tempdir, script_callbacks, ui, progress, ui_extra_networks
while 1:
if shared.opts.clean_temp_dir_at_start:
ui_tempdir.cleanup_tmpdr()
s... | 263 | 402 | 1,286 | 1,688 | from __future__ import annotations
import os
import time
from modules import timer
from modules import initialize_util
from modules import initialize
startup_timer = timer.startup_timer
startup_timer.record("launcher")
initialize.imports()
initialize.check_versions()
def create_api(app):
from modules.api.api... | from __future__ import annotations
import os
import time
from modules import timer
from modules import initialize_util
from modules import initialize
startup_timer = timer.startup_timer
startup_timer.record("launcher")
initialize.imports()
initialize.check_versions()
def create_api(app):
from modules.api.api... | |
401 | /home/hieuvd/dung_repo/raw/stars_01/AirtestProject_Airtest/Airtest | /home/hieuvd/dung_repo/raw/stars_01/AirtestProject_Airtest/Airtest/playground/xy.py | 17,18 | 5,24 | tearDown | CustomAirtestCase | 18,24 | 18,24 | class CustomAirtestCase(AirtestCase):
def setUp(self):
print("custom setup")
# add var/function/class/.. to globals
# self.scope["hunter"] = "i am hunter"
# self.scope["add"] = lambda x: x+1
# exec setup script
# self.exec_other_script("setup.owl")
super(Cus... | class CustomAirtestCase(AirtestCase):
def setUp(self):
print("custom setup")
# add var/function/class/.. to globals
# self.scope["hunter"] = "i am hunter"
# self.scope["add"] = lambda x: x+1
# exec setup script
# self.exec_other_script("setup.owl")
super(Cus... | print("custom tearDown")
# exec teardown script
# self.exec_other_script("teardown.owl")
super(CustomAirtestCase, self).setUp()
| print("custom tearDown")
# exec teardown script
# self.exec_other_script("teardown.owl")
super(CustomAirtestCase, self).setUp()
| 10 | 133 | 56 | 189 | from airtest.cli.runner import AirtestCase, run_script
from airtest.cli.parser import runner_parser
class CustomAirtestCase(AirtestCase):
def setUp(self):
print("custom setup")
# add var/function/class/.. to globals
# self.scope["hunter"] = "i am hunter"
# self.scope["add"] = lamb... | from airtest.cli.runner import AirtestCase, run_script
from airtest.cli.parser import runner_parser
class CustomAirtestCase(AirtestCase):
def setUp(self):
print("custom setup")
# add var/function/class/.. to globals
# self.scope["hunter"] = "i am hunter"
# self.scope["add"] = lamb... |
402 | /home/hieuvd/dung_repo/raw/stars_01/AirtestProject_Airtest/Airtest | /home/hieuvd/dung_repo/raw/stars_01/AirtestProject_Airtest/Airtest/setup.py | 13,14 | 1,87 | get_version | 14,23 | 14,23 | import os
import sys
import codecs
from setuptools import setup, find_packages
def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), 'r') as fp:
return fp.read()
def get_version(rel_path):
FILL_FUNC_BODYdef is_docker():
if os.path.ex... | import os
import sys
import codecs
from setuptools import setup, find_packages
def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), 'r') as fp:
return fp.read()
def get_version(rel_path):
FILL_FUNC_BODYdef is_docker():
if os.path.ex... | for line in read(rel_path).splitlines():
if line.startswith('__version__'):
# __version__ = "1.x.x"
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")
| for line in read(rel_path).splitlines():
if line.startswith('__version__'):
# __version__ = "1.x.x"
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")
| 28 | 898 | 97 | 995 | import os
import sys
import codecs
from setuptools import setup, find_packages
def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), 'r') as fp:
return fp.read()
def get_version(rel_path):
FILL_FUNC_BODYdef is_docker():
if os.path.ex... | import os
import sys
import codecs
from setuptools import setup, find_packages
def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), 'r') as fp:
return fp.read()
def get_version(rel_path):
FILL_FUNC_BODYdef is_docker():
if os.path.ex... | |
404 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/config/crypto/pyaes/blockfeeder.py | 156,157 | 144,186 | feed | BlockFeeder | 163,186 | 157,186 | class BlockFeeder(object):
'''The super-class for objects to handle chunking a stream of bytes
into the appropriate block size for the underlying mode of operation
and applying (or stripping) padding, as necessary.'''
def __init__(self, mode, feed, final, padding = PADDING_DEFAULT):
self.... | class BlockFeeder(object):
'''The super-class for objects to handle chunking a stream of bytes
into the appropriate block size for the underlying mode of operation
and applying (or stripping) padding, as necessary.'''
def __init__(self, mode, feed, final, padding = PADDING_DEFAULT):
self.... |
if self._buffer is None:
raise ValueError('already finished feeder')
# Finalize; process the spare bytes we were keeping
if data is None:
result = self._final(self._buffer, self._padding)
self._buffer = None
return result
self._buffer +=... | '''Provide bytes to encrypt (or decrypt), returning any bytes
possible from this or any previous calls to feed.
Call with None or an empty string to flush the mode of
operation and return any final bytes; no further calls to
feed may be made.'''
if self._buf... | 69 | 205 | 222 | 427 | # The MIT License (MIT)
#
# Copyright (c) 2014 Richard Moore
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... | # The MIT License (MIT)
#
# Copyright (c) 2014 Richard Moore
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... |
406 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/config/homes.py | 82,83 | 1,193 | sessions | 83,193 | 83,193 | import pwd
import os
def directories():
"""
Retrieve all users' homes
"""
visited = set()
# Get all user data stored on the Unix Password Database
for pw in pwd.getpwall():
if pw.pw_dir not in visited:
yield pw.pw_dir
visited.add(pw.pw_dir)
# Get current u... | import pwd
import os
def directories():
"""
Retrieve all users' homes
"""
visited = set()
# Get all user data stored on the Unix Password Database
for pw in pwd.getpwall():
if pw.pw_dir not in visited:
yield pw.pw_dir
visited.add(pw.pw_dir)
# Get current u... | import psutil
visited = set()
try:
for process in psutil.process_iter():
try:
if hasattr(process, 'environ'):
environ = process.environ()
else:
# Fallback to manual linux-only method
# if psutil... | import psutil
visited = set()
try:
for process in psutil.process_iter():
try:
if hasattr(process, 'environ'):
environ = process.environ()
else:
# Fallback to manual linux-only method
# if psutil... | 280 | 793 | 1,055 | 1,848 | import pwd
import os
def directories():
"""
Retrieve all users' homes
"""
visited = set()
# Get all user data stored on the Unix Password Database
for pw in pwd.getpwall():
if pw.pw_dir not in visited:
yield pw.pw_dir
visited.add(pw.pw_dir)
# Get current u... | import pwd
import os
def directories():
"""
Retrieve all users' homes
"""
visited = set()
# Get all user data stored on the Unix Password Database
for pw in pwd.getpwall():
if pw.pw_dir not in visited:
yield pw.pw_dir
visited.add(pw.pw_dir)
# Get current u... | |
407 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/config/lib/memorpy/Address.py | 48,49 | 23,112 | write | Address | 49,53 | 49,53 | class Address(object):
""" this class is used to have better representation of memory addresses """
def __init__(self, value, process, default_type = 'uint'):
self.value = int(value)
self.process = process
self.default_type = default_type
self.symbolic_name = None
def read(... | class Address(object):
""" this class is used to have better representation of memory addresses """
def __init__(self, value, process, default_type = 'uint'):
self.value = int(value)
self.process = process
self.default_type = default_type
self.symbolic_name = None
def read(... | if not type:
type = self.default_type
return self.process.write(self.value, data, type=type)
| if not type:
type = self.default_type
return self.process.write(self.value, data, type=type)
| 10 | 806 | 39 | 845 | # Author: Nicolas VERDIER
# This file is part of memorpy.
#
# memorpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# memorpy is di... | # Author: Nicolas VERDIER
# This file is part of memorpy.
#
# memorpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# memorpy is di... |
408 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/config/lib/memorpy/BaseProcess.py | 40,41 | 14,67 | read | BaseProcess | 41,59 | 41,59 | class BaseProcess(object):
def __init__(self, *args, **kwargs):
""" Create and Open a process object from its pid or from its name """
self.h_process = None
self.pid = None
self.isProcessOpen = False
self.buffer = None
self.bufferlen = 0
def __del__(self):
... | class BaseProcess(object):
def __init__(self, *args, **kwargs):
""" Create and Open a process object from its pid or from its name """
self.h_process = None
self.pid = None
self.isProcessOpen = False
self.buffer = None
self.bufferlen = 0
def __del__(self):
... | if type == 's' or type == 'string':
s = self.read_bytes(int(address), bytes=maxlen)
try:
idx = s.index(b'\x00')
return s[:idx]
except:
if errors == 'ignore':
return s
raise ProcessException(... | if type == 's' or type == 'string':
s = self.read_bytes(int(address), bytes=maxlen)
try:
idx = s.index(b'\x00')
return s[:idx]
except:
if errors == 'ignore':
return s
raise ProcessException(... | 49 | 323 | 183 | 506 | #!/usr/bin/env python
# -*- coding: UTF8 -*-
import struct
from .utils import *
""" Base class for process not linked to any platform """
class ProcessException(Exception):
pass
class BaseProcess(object):
def __init__(self, *args, **kwargs):
""" Create and Open a process object from its pid or fr... | #!/usr/bin/env python
# -*- coding: UTF8 -*-
import struct
from .utils import *
""" Base class for process not linked to any platform """
class ProcessException(Exception):
pass
class BaseProcess(object):
def __init__(self, *args, **kwargs):
""" Create and Open a process object from its pid or fr... |
409 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/config/lib/memorpy/Locator.py | 84,85 | 24,97 | get_modified_addr | Locator | 85,97 | 85,97 | class Locator(object):
"""
take a memoryworker and a type to search
then you can feed the locator with values and it will reduce the addresses possibilities
"""
def __init__(self, mw, type = 'unknown', start = None, end = None):
self.mw = mw
self.type = type
... | class Locator(object):
"""
take a memoryworker and a type to search
then you can feed the locator with values and it will reduce the addresses possibilities
"""
def __init__(self, mw, type = 'unknown', start = None, end = None):
self.mw = mw
self.type = type
... | last = self.last_iteration
new = self.feed(self.last_value, erase_last=erase_last)
ret = {}
for type, l in last.iteritems():
typeset = set(new[type])
for addr in l:
if addr not in typeset:
if type not in ret:
... | last = self.last_iteration
new = self.feed(self.last_value, erase_last=erase_last)
ret = {}
for type, l in last.iteritems():
typeset = set(new[type])
for addr in l:
if addr not in typeset:
if type not in ret:
... | 38 | 569 | 121 | 690 | # Author: Nicolas VERDIER
# This file is part of memorpy.
#
# memorpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# memorpy is di... | # Author: Nicolas VERDIER
# This file is part of memorpy.
#
# memorpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# memorpy is di... |
410 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/config/lib/memorpy/MemWorker.py | 66,67 | 33,227 | umem_search | MemWorker | 68,72 | 67,72 | class MemWorker(object):
def __init__(self, pid=None, name=None, end_offset = None, start_offset = None, debug=True):
self.process = Process(name=name, pid=pid, debug=debug)
def __enter__(self):
return self
def __exit__(self, type, value, traceback):
self.process.close()
def ... | class MemWorker(object):
def __init__(self, pid=None, name=None, end_offset = None, start_offset = None, debug=True):
self.process = Process(name=name, pid=pid, debug=debug)
def __enter__(self):
return self
def __exit__(self, type, value, traceback):
self.process.close()
def ... | regex = re_to_unicode(regex)
for _, i in self.mem_search(str(regex), ftype='re'):
yield i
| """ like mem_search but works with unicode strings """
regex = re_to_unicode(regex)
for _, i in self.mem_search(str(regex), ftype='re'):
yield i
| 11 | 1,956 | 45 | 2,001 | # Author: Nicolas VERDIER
# This file is part of memorpy.
#
# memorpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# memorpy is di... | # Author: Nicolas VERDIER
# This file is part of memorpy.
#
# memorpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# memorpy is di... |
411 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/config/lib/memorpy/SunProcess.py | 109,110 | 39,168 | iter_region | SunProcess | 117,153 | 110,153 | class SunProcess(BaseProcess):
def __init__(self, pid=None, name=None, debug=True, ptrace=None):
''' Create and Open a process object from its pid or from its name '''
super(SunProcess, self).__init__()
self.pid = int(pid)
self.pas = None
self.writable = False
if name... | class SunProcess(BaseProcess):
def __init__(self, pid=None, name=None, debug=True, ptrace=None):
''' Create and Open a process object from its pid or from its name '''
super(SunProcess, self).__init__()
self.pid = int(pid)
self.pas = None
self.writable = False
if name... | if not self.isProcessOpen:
return
with open('/proc/%d/map'%(self.pid)) as maps_file:
while True:
mapping = maps_file.read(MAP_T.size)
if not mapping:
break
start, size, name, offset, flags, pagesize, shmid, fi... | """
optimizations :
i for inode==0 (no file mapping)
s to avoid scanning shared regions
x to avoid scanning x regions
r don't scan ronly regions
"""
if not self.isProcessOpen:
return
with open('/proc... | 112 | 794 | 317 | 1,111 | # This file is part of memorpy.
#
# memorpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# memorpy is distributed in the hope that... | # This file is part of memorpy.
#
# memorpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# memorpy is distributed in the hope that... |
412 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/config/lib/memorpy/utils.py | 62,63 | 1,122 | hex_dump | 66,122 | 63,122 | # Author: Nicolas VERDIER
# This file is part of memorpy.
#
# memorpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# memorpy is di... | # Author: Nicolas VERDIER
# This file is part of memorpy.
#
# memorpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# memorpy is di... | dump = prefix
slice = ''
if ftype != 'bytes':
structtype, structlen = type_unpack(ftype)
for i in range(0, len(data), structlen):
if addr % 16 == 0:
dump += ' '
for char in slice:
if ord(char) >= 32 and ord(char) <= 126:
... | """
function originally from pydbg, modified to display other types
"""
dump = prefix
slice = ''
if ftype != 'bytes':
structtype, structlen = type_unpack(ftype)
for i in range(0, len(data), structlen):
if addr % 16 == 0:
dump += ' '
for... | 200 | 537 | 543 | 1,080 | # Author: Nicolas VERDIER
# This file is part of memorpy.
#
# memorpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# memorpy is di... | # Author: Nicolas VERDIER
# This file is part of memorpy.
#
# memorpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# memorpy is di... | |
413 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/config/lib/memorpy/wintools.py | 26,27 | 1,36 | window_foreground_loop | 28,36 | 27,36 | # Author: Nicolas VERDIER
# This file is part of memorpy.
#
# memorpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# memorpy is di... | # Author: Nicolas VERDIER
# This file is part of memorpy.
#
# memorpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# memorpy is di... | hwnd = windll.kernel32.GetConsoleWindow()
HWND_TOPMOST = -1
SWP_NOMOVE = 2
SWP_NOSIZE = 1
while True:
windll.user32.SetWindowPos(hwnd, HWND_TOPMOST, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE)
time.sleep(timeout)
| """ set the windows python console to the foreground (for example when you are working with a fullscreen program) """
hwnd = windll.kernel32.GetConsoleWindow()
HWND_TOPMOST = -1
SWP_NOMOVE = 2
SWP_NOSIZE = 1
while True:
windll.user32.SetWindowPos(hwnd, HWND_TOPMOST, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE)
tim... | 21 | 299 | 131 | 430 | # Author: Nicolas VERDIER
# This file is part of memorpy.
#
# memorpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# memorpy is di... | # Author: Nicolas VERDIER
# This file is part of memorpy.
#
# memorpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# memorpy is di... | |
414 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/config/manage_modules.py | 31,32 | 1,72 | get_modules_names | 32,69 | 32,69 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from lazagne.config.soft_import_module import soft_import
# browsers
from lazagne.softwares.browsers.firefox_browsers import firefox_browsers
from lazagne.softwares.browsers.chromium_browsers import chromium_browsers
try:
from lazagne.softwares.memory.memorydump impor... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from lazagne.config.soft_import_module import soft_import
# browsers
from lazagne.softwares.browsers.firefox_browsers import firefox_browsers
from lazagne.softwares.browsers.chromium_browsers import chromium_browsers
try:
from lazagne.softwares.memory.memorydump impor... | return [
("lazagne.softwares.mails.clawsmail", "ClawsMail"),
("lazagne.softwares.mails.thunderbird", "Thunderbird"),
("lazagne.softwares.databases.dbvis", "DbVisualizer"),
("lazagne.softwares.sysadmin.env_variable", "Env_variable"),
("lazagne.softwares.sysadmin.apachedirector... | return [
("lazagne.softwares.mails.clawsmail", "ClawsMail"),
("lazagne.softwares.mails.thunderbird", "Thunderbird"),
("lazagne.softwares.databases.dbvis", "DbVisualizer"),
("lazagne.softwares.sysadmin.env_variable", "Env_variable"),
("lazagne.softwares.sysadmin.apachedirector... | 70 | 390 | 683 | 1,073 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from lazagne.config.soft_import_module import soft_import
# browsers
from lazagne.softwares.browsers.firefox_browsers import firefox_browsers
from lazagne.softwares.browsers.chromium_browsers import chromium_browsers
try:
from lazagne.softwares.memory.memorydump impor... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from lazagne.config.soft_import_module import soft_import
# browsers
from lazagne.softwares.browsers.firefox_browsers import firefox_browsers
from lazagne.softwares.browsers.chromium_browsers import chromium_browsers
try:
from lazagne.softwares.memory.memorydump impor... | |
415 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/config/module_info.py | 37,38 | 22,45 | info | ModuleInfo | 38,40 | 38,40 | class ModuleInfo(object):
def __init__(self, name, category, options={}, suboptions=[]):
self.name = name
self.category = category
self.options = {
'command': '-{name}'.format(name=self.name),
'action': 'store_true',
'dest': self.name,
'help': ... | class ModuleInfo(object):
def __init__(self, name, category, options={}, suboptions=[]):
self.name = name
self.category = category
self.options = {
'command': '-{name}'.format(name=self.name),
'action': 'store_true',
'dest': self.name,
'help': ... | print_debug('INFO', message)
| print_debug('INFO', message)
| 2 | 196 | 13 | 209 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
name => Name of a class
category => windows / browsers / etc
options => dictionary
- command
- action
- dest
- help
ex: ('-s', action='store_true', dest='skype', help='skype')
- options['command'] = '-s'
- options['action'] = 'store_true'
- options['dest'] = 'skyp... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
name => Name of a class
category => windows / browsers / etc
options => dictionary
- command
- action
- dest
- help
ex: ('-s', action='store_true', dest='skype', help='skype')
- options['command'] = '-s'
- options['action'] = 'store_true'
- options['dest'] = 'skyp... |
416 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/config/run.py | 30,31 | 1,87 | run_module | 34,59 | 31,59 | # -*- coding: utf-8 -*-
# !/usr/bin/python
import getpass
import traceback
from collections import OrderedDict
from lazagne.config.write_output import print_debug, StandardOutput
from lazagne.config.constant import constant
from lazagne.config.manage_modules import get_categories, get_modules
def create_module_dic()... | # -*- coding: utf-8 -*-
# !/usr/bin/python
import getpass
import traceback
from collections import OrderedDict
from lazagne.config.write_output import print_debug, StandardOutput
from lazagne.config.constant import constant
from lazagne.config.manage_modules import get_categories, get_modules
def create_module_dic()... | modules_to_launch = []
# Launch only a specific module
for i in subcategories:
if subcategories[i] and i in module:
modules_to_launch.append(i)
# Launch all modules
if not modules_to_launch:
modules_to_launch = module
for i in modules_to_launch:
try:
... | """
Run only one module
"""
modules_to_launch = []
# Launch only a specific module
for i in subcategories:
if subcategories[i] and i in module:
modules_to_launch.append(i)
# Launch all modules
if not modules_to_launch:
modules_to_launch = module
for i i... | 75 | 491 | 256 | 747 | # -*- coding: utf-8 -*-
# !/usr/bin/python
import getpass
import traceback
from collections import OrderedDict
from lazagne.config.write_output import print_debug, StandardOutput
from lazagne.config.constant import constant
from lazagne.config.manage_modules import get_categories, get_modules
def create_module_dic()... | # -*- coding: utf-8 -*-
# !/usr/bin/python
import getpass
import traceback
from collections import OrderedDict
from lazagne.config.write_output import print_debug, StandardOutput
from lazagne.config.constant import constant
from lazagne.config.manage_modules import get_categories, get_modules
def create_module_dic()... | |
417 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/config/soft_import_module.py | 9,10 | 1,33 | soft_import | 12,25 | 10,25 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from importlib import import_module
from lazagne.config.module_info import ModuleInfo
def soft_import(package_name, module_name):
FILL_FUNC_BODYclass _MOCK_ImportErrorInModule(ModuleInfo):
def __init__(self, name, exception):
super(_MOCK_ImportErrorInModule... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from importlib import import_module
from lazagne.config.module_info import ModuleInfo
def soft_import(package_name, module_name):
""" Imports module or return mock object which only print error
"""
FILL_FUNC_BODYclass _MOCK_ImportErrorInModule(ModuleInfo):
... | try:
module = import_module(package_name)
return getattr(module, module_name)
except ImportError as ex:
# Emulate import ModuleInfo: return object (function) which generates objects of type ModuleInfo
# This could be done with metaclasses, but now let's just keep it simple.
... | """ Imports module or return mock object which only print error
"""
try:
module = import_module(package_name)
return getattr(module, module_name)
except ImportError as ex:
# Emulate import ModuleInfo: return object (function) which generates objects of type ModuleInfo
#... | 50 | 197 | 159 | 356 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from importlib import import_module
from lazagne.config.module_info import ModuleInfo
def soft_import(package_name, module_name):
FILL_FUNC_BODYclass _MOCK_ImportErrorInModule(ModuleInfo):
def __init__(self, name, exception):
super(_MOCK_ImportErrorInModule... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from importlib import import_module
from lazagne.config.module_info import ModuleInfo
def soft_import(package_name, module_name):
""" Imports module or return mock object which only print error
"""
FILL_FUNC_BODYclass _MOCK_ImportErrorInModule(ModuleInfo):
... | |
418 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/config/soft_import_module.py | 31,32 | 25,33 | run | _MOCK_ImportErrorInModule | 32,33 | 32,33 | class _MOCK_ImportErrorInModule(ModuleInfo):
def __init__(self, name, exception):
super(_MOCK_ImportErrorInModule, self).__init__(name, "unused")
self.__message_to_print = "Module %s is not used due to unresolved dependence:\r\n%s" % (name, str(exception))
def run(self):
FILL_FUNC_BODY | class _MOCK_ImportErrorInModule(ModuleInfo):
def __init__(self, name, exception):
super(_MOCK_ImportErrorInModule, self).__init__(name, "unused")
self.__message_to_print = "Module %s is not used due to unresolved dependence:\r\n%s" % (name, str(exception))
def run(self):
FILL_FUNC_BODY | self.error(self.__message_to_print)
| self.error(self.__message_to_print)
| 1 | 105 | 15 | 120 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from importlib import import_module
from lazagne.config.module_info import ModuleInfo
def soft_import(package_name, module_name):
""" Imports module or return mock object which only print error
"""
try:
module = import_module(package_name)
re... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from importlib import import_module
from lazagne.config.module_info import ModuleInfo
def soft_import(package_name, module_name):
""" Imports module or return mock object which only print error
"""
try:
module = import_module(package_name)
re... |
419 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/browsers/chromium_based.py | 133,134 | 20,144 | run | ChromiumBased | 134,144 | 134,144 | class ChromiumBased(ModuleInfo):
def __init__(self, browser_name, path):
self.path = path
ModuleInfo.__init__(self, browser_name, category='browsers')
self.enc_config = {
'iv': b' ' * 16,
'length': 16,
'salt': b'saltysalt',
'iterations': 1,
... | class ChromiumBased(ModuleInfo):
def __init__(self, browser_name, path):
self.path = path
ModuleInfo.__init__(self, browser_name, category='browsers')
self.enc_config = {
'iv': b' ' * 16,
'length': 16,
'salt': b'saltysalt',
'iterations': 1,
... | all_passwords = []
for path in self.get_paths():
tmp = u'/tmp/chrome.db'
shutil.copyfile(path, tmp)
for pw in self.get_passwords(tmp):
all_passwords.append(pw)
return all_passwords
| all_passwords = []
for path in self.get_paths():
tmp = u'/tmp/chrome.db'
shutil.copyfile(path, tmp)
for pw in self.get_passwords(tmp):
all_passwords.append(pw)
return all_passwords
| 19 | 1,067 | 90 | 1,157 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import shutil
import sqlite3
import struct
import traceback
from hashlib import pbkdf2_hmac
# For non-keyring storage
from Crypto.Cipher import AES
from lazagne.config.constant import constant, python_version
from lazagne.config.crypto.pyaes import AESModeOfOp... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import shutil
import sqlite3
import struct
import traceback
from hashlib import pbkdf2_hmac
# For non-keyring storage
from Crypto.Cipher import AES
from lazagne.config.constant import constant, python_version
from lazagne.config.crypto.pyaes import AESModeOfOp... |
420 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/browsers/opera.py | 118,119 | 20,152 | parse_results | Opera | 119,152 | 119,152 | class Opera(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'opera', 'browsers')
def get_paths(self):
return homes.get(directory=u'.opera')
def run(self):
all_passwords = []
for path in self.get_paths():
# Check the use of master password
... | class Opera(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'opera', 'browsers')
def get_paths(self):
return homes.get(directory=u'.opera')
def run(self):
all_passwords = []
for path in self.get_paths():
# Check the use of master password
... |
cpt = 0
tmp_cpt = 0
values = {}
pwd_found = []
for password in passwords:
# Date (begin of the sensitive data)
match = re.search(r'(\d+-\d+-\d+)', password)
if match:
values = {}
cpt = 0
tmp_cpt... |
cpt = 0
tmp_cpt = 0
values = {}
pwd_found = []
for password in passwords:
# Date (begin of the sensitive data)
match = re.search(r'(\d+-\d+-\d+)', password)
if match:
values = {}
cpt = 0
tmp_cpt... | 92 | 1,043 | 273 | 1,316 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import os
import binascii
import hashlib
import struct
from lazagne.config.module_info import ModuleInfo
from lazagne.config.crypto.pyDes import *
from lazagne.config import homes
try:
from ConfigParser import RawConfigParser # Python 2.7
except ImportErr... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import os
import binascii
import hashlib
import struct
from lazagne.config.module_info import ModuleInfo
from lazagne.config.crypto.pyDes import *
from lazagne.config import homes
try:
from ConfigParser import RawConfigParser # Python 2.7
except ImportErr... |
421 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/chats/pidgin.py | 17,18 | 12,73 | get_password_from_dbus | Pidgin | 18,52 | 18,52 | class Pidgin(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'pidgin', 'chats')
# If pidgin is started, use the api to retrieve all passwords
def get_password_from_dbus(self):
FILL_FUNC_BODY def run(self):
pwd_found = self.get_password_from_dbus()
for path in homes.ge... | class Pidgin(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'pidgin', 'chats')
# If pidgin is started, use the api to retrieve all passwords
def get_password_from_dbus(self):
FILL_FUNC_BODY def run(self):
pwd_found = self.get_password_from_dbus()
for path in homes.ge... |
try:
import dbus
except ImportError:
self.debug('Dbus not installed: sudo apt-get install python-dbus')
return []
pwd_found = []
for _, session in homes.sessions():
try:
bus = dbus.bus.BusConnection(session)
... |
try:
import dbus
except ImportError:
self.debug('Dbus not installed: sudo apt-get install python-dbus')
return []
pwd_found = []
for _, session in homes.sessions():
try:
bus = dbus.bus.BusConnection(session)
... | 60 | 253 | 321 | 574 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import traceback
from lazagne.config.module_info import ModuleInfo
from xml.etree.cElementTree import ElementTree
from lazagne.config import homes
class Pidgin(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'pidgin', 'chats')
# If... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import traceback
from lazagne.config.module_info import ModuleInfo
from xml.etree.cElementTree import ElementTree
from lazagne.config import homes
class Pidgin(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'pidgin', 'chats')
# If... |
422 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/chats/psi.py | 38,39 | 10,63 | process_one_file | PSI | 39,58 | 39,58 | class PSI(ModuleInfo):
def __init__(self):
self.pwd_found = []
ModuleInfo.__init__(self, 'psi-im', 'chats')
def get_profiles_files(self):
for profile_dir in homes.get(directory=[u'.config/psi/profiles', u'.local/psi+/profiles']):
try:
subdirs = os.listdir(pr... | class PSI(ModuleInfo):
def __init__(self):
self.pwd_found = []
ModuleInfo.__init__(self, 'psi-im', 'chats')
def get_profiles_files(self):
for profile_dir in homes.get(directory=[u'.config/psi/profiles', u'.local/psi+/profiles']):
try:
subdirs = os.listdir(pr... | root = ElementTree(file=_path).getroot()
for item in root:
if item.tag == '{http://psi-im.org/options}accounts':
for acc in item:
values = {}
for x in acc:
if x.tag == '{http://psi-im.org/options}jid':
... | root = ElementTree(file=_path).getroot()
for item in root:
if item.tag == '{http://psi-im.org/options}accounts':
for acc in item:
values = {}
for x in acc:
if x.tag == '{http://psi-im.org/options}jid':
... | 43 | 360 | 190 | 550 | # -*- coding: utf-8 -*-
import os
from xml.etree.cElementTree import ElementTree
from itertools import cycle
from lazagne.config.module_info import ModuleInfo
from lazagne.config import homes
class PSI(ModuleInfo):
def __init__(self):
self.pwd_found = []
ModuleInfo.__init__(self, 'psi-im', 'cha... | # -*- coding: utf-8 -*-
import os
from xml.etree.cElementTree import ElementTree
from itertools import cycle
from lazagne.config.module_info import ModuleInfo
from lazagne.config import homes
class PSI(ModuleInfo):
def __init__(self):
self.pwd_found = []
ModuleInfo.__init__(self, 'psi-im', 'cha... |
423 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/databases/dbvis.py | 46,47 | 18,87 | run | DbVisualizer | 47,87 | 47,87 | class DbVisualizer(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'dbvis', 'databases')
self._salt = self.get_salt()
self._passphrase = 'qinda'
self._iteration = 10
def get_salt(self):
salt_array = [-114, 18, 57, -100, 7, 114, 111, 90]
salt = array.ar... | class DbVisualizer(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'dbvis', 'databases')
self._salt = self.get_salt()
self._passphrase = 'qinda'
self._iteration = 10
def get_salt(self):
salt_array = [-114, 18, 57, -100, 7, 114, 111, 90]
salt = array.ar... |
pwd_found = []
for home in homes.get(directory=u'.dbvis'):
path = os.path.join(home, u'config70', u'dbvis.xml')
if os.path.exists(path):
tree = ElementTree(file=path)
elements = {'Alias': 'Name', 'Userid': 'Login', 'Password': 'Password',
... |
pwd_found = []
for home in homes.get(directory=u'.dbvis'):
path = os.path.join(home, u'config70', u'dbvis.xml')
if os.path.exists(path):
tree = ElementTree(file=path)
elements = {'Alias': 'Name', 'Userid': 'Login', 'Password': 'Password',
... | 94 | 374 | 408 | 782 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import binascii
import hashlib
import base64
import array
import re
import os
from xml.etree.cElementTree import ElementTree
from lazagne.config.module_info import ModuleInfo
from lazagne.config.crypto.pyDes import des, CBC
from lazagne.config import homes
class DbVis... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import binascii
import hashlib
import base64
import array
import re
import os
from xml.etree.cElementTree import ElementTree
from lazagne.config.module_info import ModuleInfo
from lazagne.config.crypto.pyDes import des, CBC
from lazagne.config import homes
class DbVis... |
424 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/databases/sqldeveloper.py | 57,58 | 23,177 | decrypt_v19_2 | SQLDeveloper | 58,72 | 58,72 | class SQLDeveloper(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'sqldeveloper', 'databases')
self._salt = self.get_salt()
self._passphrase = None
self._iteration = 42
def get_salt(self):
salt_array = [5, 19, -103, 66, -109, 114, -24, -83]
salt = arr... | class SQLDeveloper(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'sqldeveloper', 'databases')
self._salt = self.get_salt()
self._passphrase = None
self._iteration = 42
def get_salt(self):
salt_array = [5, 19, -103, 66, -109, 114, -24, -83]
salt = arr... | encrypted_password = base64.b64decode(encrypted)
salt = array.array('b', [6, -74, 97, 35, 61, 104, 50, -72])
key = hashlib.pbkdf2_hmac("sha256", db_system_id.encode(), salt, 5000, 32)
iv = encrypted_password[:16]
encrypted_password = encrypted_password[16:]
try:
... | encrypted_password = base64.b64decode(encrypted)
salt = array.array('b', [6, -74, 97, 35, 61, 104, 50, -72])
key = hashlib.pbkdf2_hmac("sha256", db_system_id.encode(), salt, 5000, 32)
iv = encrypted_password[:16]
encrypted_password = encrypted_password[16:]
try:
... | 38 | 1,749 | 185 | 1,934 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Passwords decryption for new verion have been taken from:
# https://github.com/maaaaz/sqldeveloperpassworddecryptor
import binascii
import hashlib
import base64
import array
import json
import re
import os
from xml.etree.cElementTree import ElementTree
from Crypto.Cip... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Passwords decryption for new verion have been taken from:
# https://github.com/maaaaz/sqldeveloperpassworddecryptor
import binascii
import hashlib
import base64
import array
import json
import re
import os
from xml.etree.cElementTree import ElementTree
from Crypto.Cip... |
425 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/databases/squirrel.py | 19,20 | 12,40 | parse_xml | Squirrel | 20,34 | 20,34 | class Squirrel(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'squirrel', 'databases')
def get_paths(self):
return homes.get(file=os.path.join('.squirrel-sql', 'SQLAliases23.xml'))
def parse_xml(self, path):
FILL_FUNC_BODY def run(self):
all_passwords = []
fo... | class Squirrel(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'squirrel', 'databases')
def get_paths(self):
return homes.get(file=os.path.join('.squirrel-sql', 'SQLAliases23.xml'))
def parse_xml(self, path):
FILL_FUNC_BODY def run(self):
all_passwords = []
fo... | pwd_found = []
if os.path.exists(path):
tree = ElementTree(file=path)
elements = {'name': 'Name', 'url': 'URL', 'userName': 'Login', 'password': 'Password'}
for elem in tree.iter('Bean'):
values = {}
for e in elem:
i... | pwd_found = []
if os.path.exists(path):
tree = ElementTree(file=path)
elements = {'name': 'Name', 'url': 'URL', 'userName': 'Login', 'password': 'Password'}
for elem in tree.iter('Bean'):
values = {}
for e in elem:
i... | 41 | 146 | 145 | 291 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from xml.etree.cElementTree import ElementTree
from lazagne.config import homes
from lazagne.config.module_info import ModuleInfo
class Squirrel(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'squirrel', 'databases')
def get_paths... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from xml.etree.cElementTree import ElementTree
from lazagne.config import homes
from lazagne.config.module_info import ModuleInfo
class Squirrel(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'squirrel', 'databases')
def get_paths... |
426 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/git/gitforlinux.py | 18,19 | 14,74 | extract_credentials | GitForLinux | 26,41 | 19,41 | class GitForLinux(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'gitforlinux', 'git')
def extract_credentials(self, location):
FILL_FUNC_BODY def run(self):
"""
Main function
"""
known_locations = set()
# According to the "git-credential-store" d... | class GitForLinux(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'gitforlinux', 'git')
def extract_credentials(self, location):
"""
Extract the credentials from a Git store file.
See "https://git-scm.com/docs/git-credential-store" for file format.
:param loc... | pwd_found = []
if os.path.isfile(location):
with open(location) as f:
# One line have the following format: https://user:pass@example.com
for cred in f:
if len(cred) > 0:
parts = urlparse(cred)
... | """
Extract the credentials from a Git store file.
See "https://git-scm.com/docs/git-credential-store" for file format.
:param location: Full path to the Git store file
:return: List of credentials founds
"""
pwd_found = []
if os.path.isfile(location):
... | 42 | 442 | 160 | 602 | # -*- coding: utf-8 -*-
import os
import psutil
try:
from urlparse import urlparse, unquote
except ImportError:
from urllib.parse import urlparse, unquote
from lazagne.config.module_info import ModuleInfo
from lazagne.config import homes
class GitForLinux(ModuleInfo):
def __init__(self):
Modul... | # -*- coding: utf-8 -*-
import os
import psutil
try:
from urlparse import urlparse, unquote
except ImportError:
from urllib.parse import urlparse, unquote
from lazagne.config.module_info import ModuleInfo
from lazagne.config import homes
class GitForLinux(ModuleInfo):
def __init__(self):
Modul... |
427 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/memory/mimipy.py | 159,160 | 26,172 | run | Mimipy | 160,172 | 160,172 | class Mimipy(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'mimipy', 'memory')
self.shadow_hashes = []
self.rules = [
{
"desc": "[SYSTEM - GNOME]",
"process": r"gnome-keyring-daemon|gdm-password|gdm-session-worker",
"n... | class Mimipy(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'mimipy', 'memory')
self.shadow_hashes = []
self.rules = [
{
"desc": "[SYSTEM - GNOME]",
"process": r"gnome-keyring-daemon|gdm-password|gdm-session-worker",
"n... | if os.getuid() != 0:
self.info('You need sudo privileges')
return
pwd_found = []
for t, process, user, password in self.mimipy_loot_passwords(optimizations="nsrx"):
pwd_found.append({
'Process': str(process),
'Login': str(user)... | if os.getuid() != 0:
self.info('You need sudo privileges')
return
pwd_found = []
for t, process, user, password in self.mimipy_loot_passwords(optimizations="nsrx"):
pwd_found.append({
'Process': str(process),
'Login': str(user)... | 29 | 1,609 | 125 | 1,734 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Author: Nicolas VERDIER (contact@n1nj4.eu)
Original idea from @huntergregal (https://github.com/huntergregal/mimipenguin)
This is a port in python of @huntergregal's bash script mimipenguin.sh with some improvments :
- possibility to clean passwords... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Author: Nicolas VERDIER (contact@n1nj4.eu)
Original idea from @huntergregal (https://github.com/huntergregal/mimipenguin)
This is a port in python of @huntergregal's bash script mimipenguin.sh with some improvments :
- possibility to clean passwords... |
428 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/sysadmin/apachedirectorystudio.py | 45,46 | 11,64 | run | ApacheDirectoryStudio | 49,64 | 46,64 | class ApacheDirectoryStudio(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'apachedirectorystudio', 'sysadmin')
# Interesting XML attributes in ADS connection configuration
self.attr_to_extract = ["host", "port", "bindPrincipal", "bindPassword", "authMethod"]
def extract_co... | class ApacheDirectoryStudio(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'apachedirectorystudio', 'sysadmin')
# Interesting XML attributes in ADS connection configuration
self.attr_to_extract = ["host", "port", "bindPrincipal", "bindPassword", "authMethod"]
def extract_co... | # Extract all available connections credentials
repos_creds = self.extract_connections_credentials()
# Parse and process the list of connections credentials
pwd_found = []
for creds in repos_creds:
pwd_found.append({
"Host" : creds["h... | """
Main function
"""
# Extract all available connections credentials
repos_creds = self.extract_connections_credentials()
# Parse and process the list of connections credentials
pwd_found = []
for creds in repos_creds:
pwd_found.append({
... | 44 | 419 | 161 | 580 | # -*- coding: utf-8 -*-
from xml.etree.ElementTree import parse
from lazagne.config.module_info import ModuleInfo
from lazagne.config.constant import *
from lazagne.config import homes
import os
class ApacheDirectoryStudio(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'apachedirectorystud... | # -*- coding: utf-8 -*-
from xml.etree.ElementTree import parse
from lazagne.config.module_info import ModuleInfo
from lazagne.config.constant import *
from lazagne.config import homes
import os
class ApacheDirectoryStudio(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'apachedirectorystud... |
429 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/sysadmin/aws.py | 37,38 | 15,49 | run | Aws | 38,49 | 38,49 | class Aws(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'aws', 'sysadmin')
def get_paths(self):
return homes.get(file=os.path.join('.aws', 'credentials'))
def get_creds(self, path):
try:
parser = ConfigParser()
parser.read(path)
except E... | class Aws(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'aws', 'sysadmin')
def get_paths(self):
return homes.get(file=os.path.join('.aws', 'credentials'))
def get_creds(self, path):
try:
parser = ConfigParser()
parser.read(path)
except E... | all_passwords = []
for path in self.get_paths():
for section, key, secret in self.get_creds(path):
all_passwords.append({
'ID': key,
'KEY': secret,
'Service': 'AWS',
'Name': section
... | all_passwords = []
for path in self.get_paths():
for section, key, secret in self.get_creds(path):
all_passwords.append({
'ID': key,
'KEY': secret,
'Service': 'AWS',
'Name': section
... | 25 | 189 | 97 | 286 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lazagne.config.module_info import ModuleInfo
from lazagne.config import homes
try:
from ConfigParser import ConfigParser # Python 2.7
except ImportError:
from configparser import ConfigParser # Python 3
class Aws(ModuleInfo):
def __init__(s... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lazagne.config.module_info import ModuleInfo
from lazagne.config import homes
try:
from ConfigParser import ConfigParser # Python 2.7
except ImportError:
from configparser import ConfigParser # Python 3
class Aws(ModuleInfo):
def __init__(s... |
430 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/sysadmin/cli.py | 21,22 | 17,135 | get_files | Cli | 22,59 | 22,59 | class Cli(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'cli', 'sysadmin')
def get_files(self):
FILL_FUNC_BODY def get_lines(self):
known = set()
for user, plainfile in self.get_files():
try:
with open(plainfile) as infile:
... | class Cli(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'cli', 'sysadmin')
def get_files(self):
FILL_FUNC_BODY def get_lines(self):
known = set()
for user, plainfile in self.get_files():
try:
with open(plainfile) as infile:
... | known = set()
for user, histfile in homes.users(file=['.history', '.sh_history', '.bash_history', '.zhistory']):
yield user, histfile
known.add(histfile)
try:
for process in psutil.process_iter():
try:
environ = process.env... | known = set()
for user, histfile in homes.users(file=['.history', '.sh_history', '.bash_history', '.zhistory']):
yield user, histfile
known.add(histfile)
try:
for process in psutil.process_iter():
try:
environ = process.env... | 81 | 639 | 330 | 969 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import psutil
import pwd
import os
from lazagne.config.module_info import ModuleInfo
from lazagne.config import homes
try:
from ConfigParser import ConfigParser # Python 2.7
except ImportError:
from configparser import ConfigParser # Python 3
class Cli(Modul... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import psutil
import pwd
import os
from lazagne.config.module_info import ModuleInfo
from lazagne.config import homes
try:
from ConfigParser import ConfigParser # Python 2.7
except ImportError:
from configparser import ConfigParser # Python 3
class Cli(Modul... |
431 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/sysadmin/docker.py | 30,31 | 10,43 | run | Docker | 31,43 | 31,43 | class Docker(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'docker', 'sysadmin')
def get_paths(self):
return homes.get(file=os.path.join('.docker', 'config.json'))
def get_creds(self, path):
try:
with open(path) as config:
config = json.load... | class Docker(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'docker', 'sysadmin')
def get_paths(self):
return homes.get(file=os.path.join('.docker', 'config.json'))
def get_creds(self, path):
try:
with open(path) as config:
config = json.load... | all_passwords = []
for path in self.get_paths():
for hub, user, password in self.get_creds(path):
all_passwords.append(
{
'User': user,
'Password': password,
'Hub': hub,
... | all_passwords = []
for path in self.get_paths():
for hub, user, password in self.get_creds(path):
all_passwords.append(
{
'User': user,
'Password': password,
'Hub': hub,
... | 25 | 188 | 96 | 284 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import os
from lazagne.config.module_info import ModuleInfo
from lazagne.config import homes
class Docker(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'docker', 'sysadmin')
def get_paths(self):
return homes.get(file=os.p... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import os
from lazagne.config.module_info import ModuleInfo
from lazagne.config import homes
class Docker(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'docker', 'sysadmin')
def get_paths(self):
return homes.get(file=os.p... |
432 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/sysadmin/env_variable.py | 17,18 | 13,128 | run | Env_variable | 18,128 | 18,128 | class Env_variable(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'Environment variables', 'sysadmin')
def run(self):
FILL_FUNC_BODY | class Env_variable(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'Environment variables', 'sysadmin')
def run(self):
FILL_FUNC_BODY | pwd_found = []
known_proxies = set()
known_tokens = set()
blacklist = (
'PWD', 'OLDPWD', 'SYSTEMD_NSS_BYPASS_BUS', 'SYSTEMD_NSS_DYNAMIC_BYPASS'
)
proxies = (
'http_proxy', 'https_proxy',
'HTTP_Proxy', 'HTTPS_Proxy',
'HTTP_... | pwd_found = []
known_proxies = set()
known_tokens = set()
blacklist = (
'PWD', 'OLDPWD', 'SYSTEMD_NSS_BYPASS_BUS', 'SYSTEMD_NSS_DYNAMIC_BYPASS'
)
proxies = (
'http_proxy', 'https_proxy',
'HTTP_Proxy', 'HTTPS_Proxy',
'HTTP_... | 215 | 53 | 988 | 1,041 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import psutil
from lazagne.config.module_info import ModuleInfo
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
class Env_variable(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'Environment variab... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import psutil
from lazagne.config.module_info import ModuleInfo
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
class Env_variable(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'Environment variab... |
433 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/sysadmin/fstab.py | 13,14 | 9,37 | run | Fstab | 14,37 | 14,37 | class Fstab(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'fstab', 'sysadmin')
def run(self):
FILL_FUNC_BODY | class Fstab(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'fstab', 'sysadmin')
def run(self):
FILL_FUNC_BODY | pwd_found = []
path = '/etc/fstab'
if os.path.exists(path):
try:
with open(path) as fstab:
for line in fstab:
line = line.strip()
if not line or line.startswith('#'):
conti... | pwd_found = []
path = '/etc/fstab'
if os.path.exists(path):
try:
with open(path) as fstab:
for line in fstab:
line = line.strip()
if not line or line.startswith('#'):
conti... | 60 | 51 | 211 | 262 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lazagne.config.module_info import ModuleInfo
class Fstab(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'fstab', 'sysadmin')
def run(self):
FILL_FUNC_BODY | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lazagne.config.module_info import ModuleInfo
class Fstab(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'fstab', 'sysadmin')
def run(self):
FILL_FUNC_BODY |
434 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/sysadmin/gftp.py | 39,40 | 13,111 | run | gFTP | 43,111 | 40,111 | class gFTP(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'gftp', 'sysadmin')
self.attr_to_extract = ["host", "port", "username", "password", "protocol", "account", "entry"]
def decode_password(self, encoded_pass):
"""
Password is offuscated: first char is a $. Then... | class gFTP(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'gftp', 'sysadmin')
self.attr_to_extract = ["host", "port", "username", "password", "protocol", "account", "entry"]
def decode_password(self, encoded_pass):
"""
Password is offuscated: first char is a $. Then... |
# Extract all available connections credentials
pwd_found = []
for connection_file_directory in homes.get(directory=u'.gftp'):
connection_file_location = os.path.join(connection_file_directory, u'bookmarks')
if os.path.isfile(connection_file_location):
c... | """
Main function
"""
# Extract all available connections credentials
pwd_found = []
for connection_file_directory in homes.get(directory=u'.gftp'):
connection_file_location = os.path.join(connection_file_directory, u'bookmarks')
if os.path.isfil... | 193 | 388 | 916 | 1,304 | # -*- coding: utf-8 -*-
from lazagne.config.module_info import ModuleInfo
from lazagne.config.constant import *
from lazagne.config import homes
import os
try:
from ConfigParser import RawConfigParser # Python 2.7
except ImportError:
from configparser import RawConfigParser # Python 3
class gFTP(ModuleInf... | # -*- coding: utf-8 -*-
from lazagne.config.module_info import ModuleInfo
from lazagne.config.constant import *
from lazagne.config import homes
import os
try:
from ConfigParser import RawConfigParser # Python 2.7
except ImportError:
from configparser import RawConfigParser # Python 3
class gFTP(ModuleInf... |
435 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/sysadmin/grub.py | 15,16 | 10,84 | dictionary_attack | Grub | 16,50 | 16,50 | class Grub(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'grub', 'sysadmin')
def dictionary_attack(self, crypt_pwd):
FILL_FUNC_BODY def run(self):
pwd_found = []
grub_conf_files = [u'/boot/grub/menu.lst', u'/boot/grub/grub.conf', u'/boot/grub/grub.cfg']
for grub... | class Grub(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'grub', 'sysadmin')
def dictionary_attack(self, crypt_pwd):
FILL_FUNC_BODY def run(self):
pwd_found = []
grub_conf_files = [u'/boot/grub/menu.lst', u'/boot/grub/grub.conf', u'/boot/grub/grub.cfg']
for grub... | dic = get_dic() # By default 500 most famous passwords are used for the dictionary attack
if '$' not in crypt_pwd:
# Either malformed or old bcrypt password
return False
hash_type = crypt_pwd.split("$")[1]
hash_algo = {
'1': 'MD5',
}
... | dic = get_dic() # By default 500 most famous passwords are used for the dictionary attack
if '$' not in crypt_pwd:
# Either malformed or old bcrypt password
return False
hash_type = crypt_pwd.split("$")[1]
hash_algo = {
'1': 'MD5',
}
... | 102 | 458 | 353 | 811 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import crypt
import os
from lazagne.config.module_info import ModuleInfo
from lazagne.config.dico import get_dic
class Grub(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'grub', 'sysadmin')
def dictionary_attack(self, crypt_pwd):
FILL_FUNC_... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import crypt
import os
from lazagne.config.module_info import ModuleInfo
from lazagne.config.dico import get_dic
class Grub(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'grub', 'sysadmin')
def dictionary_attack(self, crypt_pwd):
FILL_FUNC_... |
436 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/sysadmin/keepassconfig.py | 21,22 | 15,107 | run | KeePassConfig | 25,107 | 22,107 | class KeePassConfig(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'keepassconfig', 'sysadmin')
self.attr_to_extract = ["Keyfile", "Database"]
def run(self):
FILL_FUNC_BODY | class KeePassConfig(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'keepassconfig', 'sysadmin')
self.attr_to_extract = ["Keyfile", "Database"]
def run(self):
"""
Main function
"""
FILL_FUNC_BODY |
pwd_found = []
#KeepassX
for connection_file_directory in homes.get(directory=u'.config/keepassx'):
#Used to replace ./ by the home path
home = connection_file_directory.partition('./config')[0]
connection_file_location = os.path.join(connection_file_directo... | """
Main function
"""
pwd_found = []
#KeepassX
for connection_file_directory in homes.get(directory=u'.config/keepassx'):
#Used to replace ./ by the home path
home = connection_file_directory.partition('./config')[0]
connection_file_l... | 199 | 83 | 909 | 992 | # -*- coding: utf-8 -*-
from lazagne.config.module_info import ModuleInfo
from lazagne.config.constant import *
from lazagne.config import homes
import os
try:
from ConfigParser import RawConfigParser # Python 2.7
except ImportError:
from configparser import RawConfigParser # Python 3
from xml.etree.Eleme... | # -*- coding: utf-8 -*-
from lazagne.config.module_info import ModuleInfo
from lazagne.config.constant import *
from lazagne.config import homes
import os
try:
from ConfigParser import RawConfigParser # Python 2.7
except ImportError:
from configparser import RawConfigParser # Python 3
from xml.etree.Eleme... |
437 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/sysadmin/rclone.py | 40,41 | 22,75 | aes_ctr_decrypt | Rclone | 45,50 | 41,50 | class Rclone(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'rclone', 'sysadmin')
# -- https://github.com/rclone/rclone/blob/master/fs/config/obscure/obscure.go
self.secret_key = b"\x9c\x93\x5b\x48\x73\x0a\x55\x4d\x6b\xfd\x7c\x63\xc8\x86\xa9\x2b\xd3\x90\x19\x8e\xb8\x12\x8a\xfb\xf... | class Rclone(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'rclone', 'sysadmin')
# -- https://github.com/rclone/rclone/blob/master/fs/config/obscure/obscure.go
self.secret_key = b"\x9c\x93\x5b\x48\x73\x0a\x55\x4d\x6b\xfd\x7c\x63\xc8\x86\xa9\x2b\xd3\x90\x19\x8e\xb8\x12\x8a\xfb\xf... | crypter = AES.new(key=self.secret_key, mode=AES.MODE_CTR, initial_value=iv, nonce=b'')
decrypted_password = crypter.decrypt(encrypted_password)
return decrypted_password.decode('utf-8')
| '''
Do not forget to set an empty nonce
https://stackoverflow.com/questions/56217725/openssh-opensshportable-which-key-should-i-extract-from-memory
'''
crypter = AES.new(key=self.secret_key, mode=AES.MODE_CTR, initial_value=iv, nonce=b'')
decrypted_password = crypter.decr... | 11 | 695 | 82 | 777 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This code has been taken from https://github.com/maaaaz/rclonedeobscure
# All credits to maaaaz
from lazagne.config.module_info import ModuleInfo
from lazagne.config import homes
import base64
import json
import os
try:
from ConfigParser import RawConfigParser # ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This code has been taken from https://github.com/maaaaz/rclonedeobscure
# All credits to maaaaz
from lazagne.config.module_info import ModuleInfo
from lazagne.config import homes
import base64
import json
import os
try:
from ConfigParser import RawConfigParser # ... |
438 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/sysadmin/shadow.py | 15,16 | 10,92 | dictionary_attack | Shadow | 16,65 | 16,65 | class Shadow(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'shadow', 'sysadmin')
def dictionary_attack(self, user, crypt_pwd):
FILL_FUNC_BODY def run(self):
shadow_file = '/etc/shadow'
if os.access(shadow_file, os.R_OK):
pwd_found = []
with open(... | class Shadow(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'shadow', 'sysadmin')
def dictionary_attack(self, user, crypt_pwd):
FILL_FUNC_BODY def run(self):
shadow_file = '/etc/shadow'
if os.access(shadow_file, os.R_OK):
pwd_found = []
with open(... | dic = get_dic() # By default 500 most famous passwords are used for the dictionary attack
dic.insert(0, user) # Add the user on the list to found weak password (login equal password)
# Different possible hash type
# ID | Method
# ----------------------------------------------... | dic = get_dic() # By default 500 most famous passwords are used for the dictionary attack
dic.insert(0, user) # Add the user on the list to found weak password (login equal password)
# Different possible hash type
# ID | Method
# ----------------------------------------------... | 171 | 333 | 542 | 875 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import crypt
import os
from lazagne.config.module_info import ModuleInfo
from lazagne.config.dico import get_dic
class Shadow(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'shadow', 'sysadmin')
def dictionary_attack(self, user, crypt_pwd):
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import crypt
import os
from lazagne.config.module_info import ModuleInfo
from lazagne.config.dico import get_dic
class Shadow(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'shadow', 'sysadmin')
def dictionary_attack(self, user, crypt_pwd):
... |
439 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/sysadmin/ssh.py | 47,48 | 9,110 | create_pw_object | Ssh | 48,57 | 48,57 | class Ssh(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'ssh', 'sysadmin')
def get_ids(self):
known = set()
for user, identity in homes.users(file=[
os.path.join('.ssh', item) for item in (
'id_rsa', 'id_dsa', 'id_ecdsa', 'id_ed25519'
... | class Ssh(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'ssh', 'sysadmin')
def get_ids(self):
known = set()
for user, identity in homes.users(file=[
os.path.join('.ssh', item) for item in (
'id_rsa', 'id_dsa', 'id_ecdsa', 'id_ed25519'
... | pw = {'KEY': identity}
if host:
pw['Host'] = host
if port:
pw['Port'] = port
if user:
pw['Login'] = user
return pw
| pw = {'KEY': identity}
if host:
pw['Host'] = host
if port:
pw['Port'] = port
if user:
pw['Login'] = user
return pw
| 21 | 696 | 67 | 763 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lazagne.config.module_info import ModuleInfo
from lazagne.config import homes
class Ssh(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'ssh', 'sysadmin')
def get_ids(self):
known = set()
for user, identity in ho... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lazagne.config.module_info import ModuleInfo
from lazagne.config import homes
class Ssh(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'ssh', 'sysadmin')
def get_ids(self):
known = set()
for user, identity in ho... |
440 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/wallet/libsecret.py | 27,28 | 23,106 | run | Libsecret | 28,106 | 28,106 | class Libsecret(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'libsecret', 'wallet')
def run(self):
FILL_FUNC_BODY | class Libsecret(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'libsecret', 'wallet')
def run(self):
FILL_FUNC_BODY | items = []
visited = set()
try:
import dbus
import secretstorage
import datetime
except ImportError as e:
self.error('libsecret: {0}'.format(e))
return []
for uid, session in homes.sessions():
try:
... | items = []
visited = set()
try:
import dbus
import secretstorage
import datetime
except ImportError as e:
self.error('libsecret: {0}'.format(e))
return []
for uid, session in homes.sessions():
try:
... | 155 | 51 | 699 | 750 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from lazagne.config.constant import constant
from lazagne.config.module_info import ModuleInfo
from lazagne.config import homes
from binascii import hexlify
import pwd
import traceback
try:
import jeepney.auth
# except ImportError:
except Exception:
pass
else:
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from lazagne.config.constant import constant
from lazagne.config.module_info import ModuleInfo
from lazagne.config import homes
from binascii import hexlify
import pwd
import traceback
try:
import jeepney.auth
# except ImportError:
except Exception:
pass
else:
... |
441 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/wifi/wifi.py | 21,22 | 17,44 | run | Wifi | 22,44 | 22,44 | class Wifi(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'wifi', 'wifi')
def run(self):
FILL_FUNC_BODY | class Wifi(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'wifi', 'wifi')
def run(self):
FILL_FUNC_BODY | pwd_found = []
directory = u'/etc/NetworkManager/system-connections'
if os.path.exists(directory):
if os.getuid() == 0:
wireless_ssid = [f for f in os.listdir(directory) if os.path.isfile(os.path.join(directory, f))]
for w in wireless_ssid:
... | pwd_found = []
directory = u'/etc/NetworkManager/system-connections'
if os.path.exists(directory):
if os.getuid() == 0:
wireless_ssid = [f for f in os.listdir(directory) if os.path.isfile(os.path.join(directory, f))]
for w in wireless_ssid:
... | 54 | 49 | 235 | 284 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lazagne.config.module_info import ModuleInfo
try:
from ConfigParser import RawConfigParser # Python 2.7
except ImportError:
from configparser import RawConfigParser # Python 3
from collections import OrderedDict
class Wifi(ModuleInfo):
d... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lazagne.config.module_info import ModuleInfo
try:
from ConfigParser import RawConfigParser # Python 2.7
except ImportError:
from configparser import RawConfigParser # Python 3
from collections import OrderedDict
class Wifi(ModuleInfo):
d... |
442 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Linux/lazagne/softwares/wifi/wpa_supplicant.py | 20,21 | 16,55 | parse_file_network | Wpa_supplicant | 21,34 | 21,34 | class Wpa_supplicant(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'wpa_supplicant', 'wifi')
def parse_file_network(self, fd):
FILL_FUNC_BODY def run(self):
pwd_found = []
wifi_path = u'/etc/wpa_supplicant/wpa_supplicant.conf'
if os.path.exists(wifi_path):
... | class Wpa_supplicant(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'wpa_supplicant', 'wifi')
def parse_file_network(self, fd):
FILL_FUNC_BODY def run(self):
pwd_found = []
wifi_path = u'/etc/wpa_supplicant/wpa_supplicant.conf'
if os.path.exists(wifi_path):
... | password = None
ssid = None
for line in fd:
if re.match('^[ \t]*ssid=', line):
ssid = (line.split("\"")[1])
if re.match('^[ \t]*psk=', line):
password = line.split("\"")[1]
if re.match('^[ \t]*password=', line):
... | password = None
ssid = None
for line in fd:
if re.match('^[ \t]*ssid=', line):
ssid = (line.split("\"")[1])
if re.match('^[ \t]*psk=', line):
password = line.split("\"")[1]
if re.match('^[ \t]*password=', line):
... | 38 | 247 | 156 | 403 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#######################
#
# By rpesche
#
#######################
import re
import os
from lazagne.config.module_info import ModuleInfo
class Wpa_supplicant(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'wpa_supplicant', 'wifi')
def parse_... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#######################
#
# By rpesche
#
#######################
import re
import os
from lazagne.config.module_info import ModuleInfo
class Wpa_supplicant(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'wpa_supplicant', 'wifi')
def parse_... |
444 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Mac/lazagne/config/crypto/pyaes/blockfeeder.py | 156,157 | 144,186 | feed | BlockFeeder | 163,186 | 157,186 | class BlockFeeder(object):
'''The super-class for objects to handle chunking a stream of bytes
into the appropriate block size for the underlying mode of operation
and applying (or stripping) padding, as necessary.'''
def __init__(self, mode, feed, final, padding = PADDING_DEFAULT):
self.... | class BlockFeeder(object):
'''The super-class for objects to handle chunking a stream of bytes
into the appropriate block size for the underlying mode of operation
and applying (or stripping) padding, as necessary.'''
def __init__(self, mode, feed, final, padding = PADDING_DEFAULT):
self.... |
if self._buffer is None:
raise ValueError('already finished feeder')
# Finalize; process the spare bytes we were keeping
if data is None:
result = self._final(self._buffer, self._padding)
self._buffer = None
return result
self._buffer +=... | '''Provide bytes to encrypt (or decrypt), returning any bytes
possible from this or any previous calls to feed.
Call with None or an empty string to flush the mode of
operation and return any final bytes; no further calls to
feed may be made.'''
if self._buf... | 69 | 205 | 222 | 427 | # The MIT License (MIT)
#
# Copyright (c) 2014 Richard Moore
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... | # The MIT License (MIT)
#
# Copyright (c) 2014 Richard Moore
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... |
446 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Mac/lazagne/config/manage_modules.py | 30,31 | 1,33 | get_modules | 31,33 | 31,33 | # -*- coding: utf-8 -*-
# !/usr/bin/python
from lazagne.config.soft_import_module import soft_import
from lazagne.softwares.browsers.firefox_browsers import firefox_browsers
def get_categories():
category = {
'browsers': {'help': 'Web browsers supported'},
'mails': {'help': 'Email clients support... | # -*- coding: utf-8 -*-
# !/usr/bin/python
from lazagne.config.soft_import_module import soft_import
from lazagne.softwares.browsers.firefox_browsers import firefox_browsers
def get_categories():
category = {
'browsers': {'help': 'Web browsers supported'},
'mails': {'help': 'Email clients support... | modules = [soft_import(package_name, module_name)() for package_name, module_name in get_modules_names()]
return modules + firefox_browsers
| modules = [soft_import(package_name, module_name)() for package_name, module_name in get_modules_names()]
return modules + firefox_browsers
| 13 | 303 | 47 | 350 | # -*- coding: utf-8 -*-
# !/usr/bin/python
from lazagne.config.soft_import_module import soft_import
from lazagne.softwares.browsers.firefox_browsers import firefox_browsers
def get_categories():
category = {
'browsers': {'help': 'Web browsers supported'},
'mails': {'help': 'Email clients support... | # -*- coding: utf-8 -*-
# !/usr/bin/python
from lazagne.config.soft_import_module import soft_import
from lazagne.softwares.browsers.firefox_browsers import firefox_browsers
def get_categories():
category = {
'browsers': {'help': 'Web browsers supported'},
'mails': {'help': 'Email clients support... | |
447 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Mac/lazagne/config/module_info.py | 32,33 | 20,43 | error | ModuleInfo | 33,35 | 33,35 | class ModuleInfo(object):
def __init__(self, name, category, sub_options=[]):
self.name = name
self.category = category
self.options = {
'command': '-{name}'.format(name=self.name),
'action': 'store_true',
'dest': self.name,
'help': '{name} pas... | class ModuleInfo(object):
def __init__(self, name, category, sub_options=[]):
self.name = name
self.category = category
self.options = {
'command': '-{name}'.format(name=self.name),
'action': 'store_true',
'dest': self.name,
'help': '{name} pas... | print_debug('ERROR', message)
| print_debug('ERROR', message)
| 2 | 194 | 13 | 207 | """
name => Name of a class
category => windows / browsers / etc
options => dictionary
- command
- action
- dest
- help
ex: ('-s', action='store_true', dest='skype', help='skype')
options['command'] = '-s'
options['action'] = 'store_true'
options['dest'] = 'skype'
options['help'] = 'skype'
"""
from lazagne.config.wri... | """
name => Name of a class
category => windows / browsers / etc
options => dictionary
- command
- action
- dest
- help
ex: ('-s', action='store_true', dest='skype', help='skype')
options['command'] = '-s'
options['action'] = 'store_true'
options['dest'] = 'skype'
options['help'] = 'skype'
"""
from lazagne.config.wri... |
448 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Mac/lazagne/config/run.py | 51,52 | 1,148 | run_module | 55,80 | 52,80 | # -*- coding: utf-8 -*-
# !/usr/bin/python
import subprocess
import traceback
import getpass
from lazagne.config.constant import constant
from lazagne.config.write_output import print_debug, StandardOutput
from lazagne.config.manage_modules import get_categories, get_modules
from lazagne.softwares.browsers.chrome impo... | # -*- coding: utf-8 -*-
# !/usr/bin/python
import subprocess
import traceback
import getpass
from lazagne.config.constant import constant
from lazagne.config.write_output import print_debug, StandardOutput
from lazagne.config.manage_modules import get_categories, get_modules
from lazagne.softwares.browsers.chrome impo... | modules_to_launch = []
# Launch only a specific module
for i in subcategories:
if subcategories[i] and i in module:
modules_to_launch.append(i)
# Launch all modules
if not modules_to_launch:
modules_to_launch = module
for i in modules_to_launch:
try:
... | """
Run only one module
"""
modules_to_launch = []
# Launch only a specific module
for i in subcategories:
if subcategories[i] and i in module:
modules_to_launch.append(i)
# Launch all modules
if not modules_to_launch:
modules_to_launch = module
for i i... | 75 | 1,046 | 256 | 1,302 | # -*- coding: utf-8 -*-
# !/usr/bin/python
import subprocess
import traceback
import getpass
from lazagne.config.constant import constant
from lazagne.config.write_output import print_debug, StandardOutput
from lazagne.config.manage_modules import get_categories, get_modules
from lazagne.softwares.browsers.chrome impo... | # -*- coding: utf-8 -*-
# !/usr/bin/python
import subprocess
import traceback
import getpass
from lazagne.config.constant import constant
from lazagne.config.write_output import print_debug, StandardOutput
from lazagne.config.manage_modules import get_categories, get_modules
from lazagne.softwares.browsers.chrome impo... | |
449 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Mac/lazagne/config/soft_import_module.py | 9,10 | 1,33 | soft_import | 12,25 | 10,25 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from importlib import import_module
from lazagne.config.module_info import ModuleInfo
def soft_import(package_name, module_name):
FILL_FUNC_BODYclass _MOCK_ImportErrorInModule(ModuleInfo):
def __init__(self, name, exception):
super(_MOCK_ImportErrorInModule... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from importlib import import_module
from lazagne.config.module_info import ModuleInfo
def soft_import(package_name, module_name):
""" Imports module or return mock object which only print error
"""
FILL_FUNC_BODYclass _MOCK_ImportErrorInModule(ModuleInfo):
... | try:
module = import_module(package_name)
return getattr(module, module_name)
except ImportError as ex:
# Emulate import ModuleInfo: return object (function) which generates objects of type ModuleInfo
# This could be done with metaclasses, but now let's just keep it simple.
... | """ Imports module or return mock object which only print error
"""
try:
module = import_module(package_name)
return getattr(module, module_name)
except ImportError as ex:
# Emulate import ModuleInfo: return object (function) which generates objects of type ModuleInfo
#... | 50 | 197 | 159 | 356 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from importlib import import_module
from lazagne.config.module_info import ModuleInfo
def soft_import(package_name, module_name):
FILL_FUNC_BODYclass _MOCK_ImportErrorInModule(ModuleInfo):
def __init__(self, name, exception):
super(_MOCK_ImportErrorInModule... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from importlib import import_module
from lazagne.config.module_info import ModuleInfo
def soft_import(package_name, module_name):
""" Imports module or return mock object which only print error
"""
FILL_FUNC_BODYclass _MOCK_ImportErrorInModule(ModuleInfo):
... | |
450 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Mac/lazagne/config/soft_import_module.py | 31,32 | 25,33 | run | _MOCK_ImportErrorInModule | 32,33 | 32,33 | class _MOCK_ImportErrorInModule(ModuleInfo):
def __init__(self, name, exception):
super(_MOCK_ImportErrorInModule, self).__init__(name, "unused")
self.__message_to_print = "Module %s is not used due to unresolved dependence:\r\n%s" % (name, str(exception))
def run(self):
FILL_FUNC_BODY | class _MOCK_ImportErrorInModule(ModuleInfo):
def __init__(self, name, exception):
super(_MOCK_ImportErrorInModule, self).__init__(name, "unused")
self.__message_to_print = "Module %s is not used due to unresolved dependence:\r\n%s" % (name, str(exception))
def run(self):
FILL_FUNC_BODY | self.error(self.__message_to_print)
| self.error(self.__message_to_print)
| 1 | 105 | 15 | 120 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from importlib import import_module
from lazagne.config.module_info import ModuleInfo
def soft_import(package_name, module_name):
""" Imports module or return mock object which only print error
"""
try:
module = import_module(package_name)
re... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from importlib import import_module
from lazagne.config.module_info import ModuleInfo
def soft_import(package_name, module_name):
""" Imports module or return mock object which only print error
"""
try:
module = import_module(package_name)
re... |
451 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Mac/lazagne/softwares/system/chainbreaker.py | 40,41 | 18,125 | run | ChainBreaker | 41,125 | 41,125 | class ChainBreaker(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'chainbreaker', 'system')
def list_users(self):
users_dir = '/Users'
users_list = []
if os.path.exists(users_dir):
for user in os.listdir(users_dir):
if user != 'Shared' and... | class ChainBreaker(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'chainbreaker', 'system')
def list_users(self):
users_dir = '/Users'
users_list = []
if os.path.exists(users_dir):
for user in os.listdir(users_dir):
if user != 'Shared' and... | pwd_found = []
# all passwords found on other applications
passwords = constant.passwordFound
# password entered by the user using the --password parameter
if constant.user_password:
passwords.insert(0, constant.user_password)
# System keychain
keycha... | pwd_found = []
# all passwords found on other applications
passwords = constant.passwordFound
# password entered by the user using the --password parameter
if constant.user_password:
passwords.insert(0, constant.user_password)
# System keychain
keycha... | 294 | 236 | 1,007 | 1,243 | # -*- coding: utf-8 -*-
# !/usr/bin/python
# Awesome work done by @n0fate
# check the chainbreaker tool: https://github.com/n0fate/chainbreaker
import subprocess
import binascii
import traceback
from lazagne.softwares.system.chainbreaker_module.chainbreaker import *
from lazagne.config.module_info import ModuleInfo... | # -*- coding: utf-8 -*-
# !/usr/bin/python
# Awesome work done by @n0fate
# check the chainbreaker tool: https://github.com/n0fate/chainbreaker
import subprocess
import binascii
import traceback
from lazagne.softwares.system.chainbreaker_module.chainbreaker import *
from lazagne.config.module_info import ModuleInfo... |
453 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Mac/lazagne/softwares/system/system.py | 12,13 | 8,18 | run | System | 13,18 | 13,18 | class System(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'system', 'system')
def run(self):
FILL_FUNC_BODY | class System(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'system', 'system')
def run(self):
FILL_FUNC_BODY | pwd_found = []
pwd_found += constant.keychains_pwd
pwd_found += constant.system_pwd
return pwd_found
| pwd_found = []
pwd_found += constant.keychains_pwd
pwd_found += constant.system_pwd
return pwd_found
| 11 | 48 | 49 | 97 | # -*- coding: utf-8 -*-
# !/usr/bin/python
from lazagne.config.module_info import ModuleInfo
from lazagne.config.constant import constant
class System(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'system', 'system')
def run(self):
FILL_FUNC_BODY | # -*- coding: utf-8 -*-
# !/usr/bin/python
from lazagne.config.module_info import ModuleInfo
from lazagne.config.constant import constant
class System(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, 'system', 'system')
def run(self):
FILL_FUNC_BODY |
454 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/blob.py | 51,52 | 23,140 | parse | DPAPIBlob | 59,82 | 52,82 | class DPAPIBlob(DataStruct):
"""Represents a DPAPI blob"""
def __init__(self, raw=None):
"""
Constructs a DPAPIBlob. If raw is set, automatically calls parse().
"""
self.version = None
self.provider = None
self.mkguid = None
self.mkversion = None
... | class DPAPIBlob(DataStruct):
"""Represents a DPAPI blob"""
def __init__(self, raw=None):
"""
Constructs a DPAPIBlob. If raw is set, automatically calls parse().
"""
self.version = None
self.provider = None
self.mkguid = None
self.mkversion = None
... | self.version = data.eat("L")
self.provider = b"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" % data.eat("L2H8B")
# For HMAC computation
blobStart = data.ofs
self.mkversion = data.eat("L")
self.mkguid = b"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" % data.eat("... | """Parses the given data. May raise exceptions if incorrect data are
given. You should not call this function yourself; DataStruct does
data is a DataStruct object.
Returns nothing.
"""
self.version = data.eat("L")
self.provider = b"%08x-%04x-%04x-%0... | 64 | 1,076 | 456 | 1,532 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import traceback
from .eater import DataStruct
from . import crypto
from lazagne.config.write_output imp... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import traceback
from .eater import DataStruct
from . import crypto
from lazagne.config.write_output imp... |
455 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/credfile.py | 92,93 | 73,109 | decrypt | CredFile | 93,109 | 93,109 | class CredFile(DataStruct):
"""
Decrypt Credentials Files stored on ...\\Microsoft\\Credentials\\...
"""
def __init__(self, raw=None):
self.unknown1 = None
self.blob_size = None
self.unknown2 = None
self.blob = None
DataStruct.__init__(self, raw)
def parse(se... | class CredFile(DataStruct):
"""
Decrypt Credentials Files stored on ...\\Microsoft\\Credentials\\...
"""
def __init__(self, raw=None):
self.unknown1 = None
self.blob_size = None
self.unknown2 = None
self.blob = None
DataStruct.__init__(self, raw)
def parse(se... | ok, msg = self.blob.decrypt_encrypted_blob(mkp=mkp)
if ok:
cred_dec = CredentialDecrypted(msg)
if cred_dec.header.unk_type in [2, 3]:
return True, {
'File': credfile,
'Domain': cred_dec.domain,
'Username'... | ok, msg = self.blob.decrypt_encrypted_blob(mkp=mkp)
if ok:
cred_dec = CredentialDecrypted(msg)
if cred_dec.header.unk_type in [2, 3]:
return True, {
'File': credfile,
'Domain': cred_dec.domain,
'Username'... | 48 | 210 | 203 | 413 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
from .blob import DPAPIBlob
from .eater import DataStruct
class CredentialDecryptedHeader(DataStruct):
"""
H... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
from .blob import DPAPIBlob
from .eater import DataStruct
class CredentialDecryptedHeader(DataStruct):
"""
H... |
456 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/credfile.py | 60,61 | 45,73 | parse | CredentialDecrypted | 61,73 | 61,73 | class CredentialDecrypted(DataStruct):
"""
Structure returned once the blob has been decrypted
"""
def __init__(self, raw=None):
self.header_size = None
self.header = None
self.domain = None
self.unk_string1 = None
self.unk_string2 = None
self.unk_string3 ... | class CredentialDecrypted(DataStruct):
"""
Structure returned once the blob has been decrypted
"""
def __init__(self, raw=None):
self.header_size = None
self.header = None
self.domain = None
self.unk_string1 = None
self.unk_string2 = None
self.unk_string3 ... | self.header_size = data.eat("L")
if self.header_size > 0:
self.header = CredentialDecryptedHeader()
self.header.parse(data.eat_sub(self.header_size - 4))
self.domain = data.eat_length_and_string("L").replace(b"\x00", b"") # Unicode
self.unk_string1 = data.eat_len... | self.header_size = data.eat("L")
if self.header_size > 0:
self.header = CredentialDecryptedHeader()
self.header.parse(data.eat_sub(self.header_size - 4))
self.domain = data.eat_length_and_string("L").replace(b"\x00", b"") # Unicode
self.unk_string1 = data.eat_len... | 49 | 140 | 296 | 436 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
from .blob import DPAPIBlob
from .eater import DataStruct
class CredentialDecryptedHeader(DataStruct):
"""
H... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
from .blob import DPAPIBlob
from .eater import DataStruct
class CredentialDecryptedHeader(DataStruct):
"""
H... |
457 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/credfile.py | 32,33 | 14,45 | parse | CredentialDecryptedHeader | 33,45 | 33,45 | class CredentialDecryptedHeader(DataStruct):
"""
Header of the structure returned once the blob has been decrypted
Header of the CredentialDecrypted class
"""
def __init__(self, raw=None):
self.total_size = None
self.unknown1 = None
self.unknown2 = None
self.unknown3 ... | class CredentialDecryptedHeader(DataStruct):
"""
Header of the structure returned once the blob has been decrypted
Header of the CredentialDecrypted class
"""
def __init__(self, raw=None):
self.total_size = None
self.unknown1 = None
self.unknown2 = None
self.unknown3 ... | self.total_size = data.eat("L")
self.unknown1 = data.eat("L")
self.unknown2 = data.eat("L")
self.unknown3 = data.eat("L")
self.last_update = data.eat("Q")
self.unknown4 = data.eat("L")
self.unk_type = data.eat("L")
self.unk_blocks = data.eat("L")
s... | self.total_size = data.eat("L")
self.unknown1 = data.eat("L")
self.unknown2 = data.eat("L")
self.unknown3 = data.eat("L")
self.last_update = data.eat("Q")
self.unknown4 = data.eat("L")
self.unk_type = data.eat("L")
self.unk_blocks = data.eat("L")
s... | 30 | 173 | 158 | 331 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
from .blob import DPAPIBlob
from .eater import DataStruct
class CredentialDecryptedHeader(DataStruct):
"""
H... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
from .blob import DPAPIBlob
from .eater import DataStruct
class CredentialDecryptedHeader(DataStruct):
"""
H... |
458 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/credhist.py | 108,109 | 98,146 | parse | CredHistFile | 109,118 | 109,118 | class CredHistFile(DataStruct):
def __init__(self, raw=None):
self.entries_list = []
self.entries = {}
self.valid = False
self.footmagic = None
self.curr_guid = None
DataStruct.__init__(self, raw)
def parse(self, data):
FILL_FUNC_BODY def addEntry(self, blob)... | class CredHistFile(DataStruct):
def __init__(self, raw=None):
self.entries_list = []
self.entries = {}
self.valid = False
self.footmagic = None
self.curr_guid = None
DataStruct.__init__(self, raw)
def parse(self, data):
FILL_FUNC_BODY def addEntry(self, blob)... | while True:
l = data.pop("L")
if l == 0:
break
self.addEntry(data.pop_string(l - 4))
self.footmagic = data.eat("L")
self.curr_guid = b"%0x-%0x-%0x-%0x%0x-%0x%0x%0x%0x%0x%0x" % data.eat("L2H8B")
| while True:
l = data.pop("L")
if l == 0:
break
self.addEntry(data.pop_string(l - 4))
self.footmagic = data.eat("L")
self.curr_guid = b"%0x-%0x-%0x-%0x%0x-%0x%0x%0x%0x%0x%0x" % data.eat("L2H8B")
| 21 | 359 | 131 | 490 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import struct
import hashlib
from . import crypto
from .eater import DataStruct
class RPC_SID(DataStruct):
"""
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import struct
import hashlib
from . import crypto
from .eater import DataStruct
class RPC_SID(DataStruct):
"""
... |
459 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/credhist.py | 58,59 | 39,98 | parse | CredhistEntry | 59,78 | 59,78 | class CredhistEntry(DataStruct):
def __init__(self, raw=None):
self.pwdhash = None
self.hmac = None
self.revision = None
self.hashAlgo = None
self.rounds = None
self.cipherAlgo = None
self.shaHashLen = None
self.ntHashLen = None
self.iv = None... | class CredhistEntry(DataStruct):
def __init__(self, raw=None):
self.pwdhash = None
self.hmac = None
self.revision = None
self.hashAlgo = None
self.rounds = None
self.cipherAlgo = None
self.shaHashLen = None
self.ntHashLen = None
self.iv = None... | self.revision = data.eat("L")
self.hashAlgo = crypto.CryptoAlgo(data.eat("L"))
self.rounds = data.eat("L")
data.eat("L")
self.cipherAlgo = crypto.CryptoAlgo(data.eat("L"))
self.shaHashLen = data.eat("L")
self.ntHashLen = data.eat("L")
self.iv = data.eat("1... | self.revision = data.eat("L")
self.hashAlgo = crypto.CryptoAlgo(data.eat("L"))
self.rounds = data.eat("L")
data.eat("L")
self.cipherAlgo = crypto.CryptoAlgo(data.eat("L"))
self.shaHashLen = data.eat("L")
self.ntHashLen = data.eat("L")
self.iv = data.eat("1... | 47 | 440 | 301 | 741 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import struct
import hashlib
from . import crypto
from .eater import DataStruct
class RPC_SID(DataStruct):
"""
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import struct
import hashlib
from . import crypto
from .eater import DataStruct
class RPC_SID(DataStruct):
"""
... |
460 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/credhist.py | 27,28 | 17,39 | parse | RPC_SID | 28,33 | 28,33 | class RPC_SID(DataStruct):
"""
Represents a RPC_SID structure. See MSDN for documentation
"""
def __init__(self, raw=None):
self.version = None
self.idAuth = None
self.subAuth = None
DataStruct.__init__(self, raw)
def parse(self, data):
FILL_FUNC_BODY def __str__(... | class RPC_SID(DataStruct):
"""
Represents a RPC_SID structure. See MSDN for documentation
"""
def __init__(self, raw=None):
self.version = None
self.idAuth = None
self.subAuth = None
DataStruct.__init__(self, raw)
def parse(self, data):
FILL_FUNC_BODY def __str__(... | self.version = data.eat("B")
n = data.eat("B")
self.idAuth = struct.unpack(">Q", b"\0\0" + data.eat("6s"))[0]
self.subAuth = data.eat("%dL" % n)
| self.version = data.eat("B")
n = data.eat("B")
self.idAuth = struct.unpack(">Q", b"\0\0" + data.eat("6s"))[0]
self.subAuth = data.eat("%dL" % n)
| 17 | 162 | 82 | 244 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import struct
import hashlib
from . import crypto
from .eater import DataStruct
class RPC_SID(DataStruct):
"""
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import struct
import hashlib
from . import crypto
from .eater import DataStruct
class RPC_SID(DataStruct):
"""
... |
461 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/eater.py | 126,127 | 119,129 | parse | DataStruct | 127,129 | 127,129 | class DataStruct(object):
"""Don't use this class unless you know what you are doing!"""
def __init__(self, raw=None):
if raw is not None:
self.parse(Eater(raw, endianness="<"))
def parse(self, eater_obj):
FILL_FUNC_BODY | class DataStruct(object):
"""Don't use this class unless you know what you are doing!"""
def __init__(self, raw=None):
if raw is not None:
self.parse(Eater(raw, endianness="<"))
def parse(self, eater_obj):
FILL_FUNC_BODY | raise NotImplementedError("This function must be implemented in subclasses")
| raise NotImplementedError("This function must be implemented in subclasses")
| 8 | 87 | 21 | 108 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#############################################################################
## ##
## This file is part of DPAPIck ##
## Windows DPAPI decryption & forensic ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#############################################################################
## ##
## This file is part of DPAPIck ##
## Windows DPAPI decryption & forensic ... |
462 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/eater.py | 59,60 | 23,119 | eat | Eater | 65,72 | 60,72 | class Eater(object):
"""This class is a helper for parsing binary structures."""
def __init__(self, raw, offset=0, end=None, endianness="<"):
self.raw = raw
self.ofs = offset
if end is None:
end = len(raw)
self.end = end
self.endianness = endianness
def ... | class Eater(object):
"""This class is a helper for parsing binary structures."""
def __init__(self, raw, offset=0, end=None, endianness="<"):
self.raw = raw
self.ofs = offset
if end is None:
end = len(raw)
self.end = end
self.endianness = endianness
def ... | fmt, sz = self.prepare_fmt(fmt)
v = struct.unpack_from(fmt, self.raw, self.ofs)
if len(v) == 1:
v = v[0]
self.ofs += sz
return v
| """Parses data with the given format string.
Returns an array of elements or just one element depending on fmt.
"""
fmt, sz = self.prepare_fmt(fmt)
v = struct.unpack_from(fmt, self.raw, self.ofs)
if len(v) == 1:
v = v[0]
self.ofs += sz
... | 21 | 824 | 79 | 903 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#############################################################################
## ##
## This file is part of DPAPIck ##
## Windows DPAPI decryption & forensic ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#############################################################################
## ##
## This file is part of DPAPIck ##
## Windows DPAPI decryption & forensic ... |
463 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/masterkey.py | 103,104 | 95,108 | parse | CredHist | 104,108 | 104,108 | class CredHist(DataStruct):
"""This class represents a Credhist block contained in the MasterKeyFile"""
def __init__(self, raw=None):
self.version = None
self.guid = None
DataStruct.__init__(self, raw)
def parse(self, data):
FILL_FUNC_BODY | class CredHist(DataStruct):
"""This class represents a Credhist block contained in the MasterKeyFile"""
def __init__(self, raw=None):
self.version = None
self.guid = None
DataStruct.__init__(self, raw)
def parse(self, data):
FILL_FUNC_BODY | self.version = data.eat("L")
self.guid = b"%0x-%0x-%0x-%0x%0x-%0x%0x%0x%0x%0x%0x" % data.eat("L2H8B")
| self.version = data.eat("L")
self.guid = b"%0x-%0x-%0x-%0x%0x-%0x%0x%0x%0x%0x%0x" % data.eat("L2H8B")
| 8 | 86 | 78 | 164 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
from . import crypto
from .credhist import CredHistFile
from .system import CredSystem
from .eater import DataStruct, Ea... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
from . import crypto
from .credhist import CredHistFile
from .system import CredSystem
from .eater import DataStruct, Ea... |
464 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/masterkey.py | 125,126 | 108,134 | parse | DomainKey | 126,134 | 126,134 | class DomainKey(DataStruct):
"""This class represents a DomainKey block contained in the MasterKeyFile.
Currently does nothing more than parsing. Work on Active Directory stuff is
still on progress.
"""
def __init__(self, raw=None):
self.version = None
self.secretLen = None
... | class DomainKey(DataStruct):
"""This class represents a DomainKey block contained in the MasterKeyFile.
Currently does nothing more than parsing. Work on Active Directory stuff is
still on progress.
"""
def __init__(self, raw=None):
self.version = None
self.secretLen = None
... | self.version = data.eat("L")
self.secretLen = data.eat("L")
self.accesscheckLen = data.eat("L")
self.guidKey = b"%0x-%0x-%0x-%0x%0x-%0x%0x%0x%0x%0x%0x" % data.eat("L2H8B") # data.eat("16s")
self.encryptedSecret = data.eat("%us" % self.secretLen)
self.accessCheck = data.e... | self.version = data.eat("L")
self.secretLen = data.eat("L")
self.accesscheckLen = data.eat("L")
self.guidKey = b"%0x-%0x-%0x-%0x%0x-%0x%0x%0x%0x%0x%0x" % data.eat("L2H8B") # data.eat("16s")
self.encryptedSecret = data.eat("%us" % self.secretLen)
self.accessCheck = data.e... | 26 | 148 | 165 | 313 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
from . import crypto
from .credhist import CredHistFile
from .system import CredSystem
from .eater import DataStruct, Ea... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
from . import crypto
from .credhist import CredHistFile
from .system import CredSystem
from .eater import DataStruct, Ea... |
465 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/masterkey.py | 74,75 | 24,95 | decrypt_with_key | MasterKey | 80,95 | 75,95 | class MasterKey(DataStruct):
"""
This class represents a MasterKey block contained in a MasterKeyFile
"""
def __init__(self, raw=None):
self.decrypted = False
self.key = None
self.key_hash = None
self.hmacSalt = None
self.hmac = None
self.hmacComputed = N... | class MasterKey(DataStruct):
"""
This class represents a MasterKey block contained in a MasterKeyFile
"""
def __init__(self, raw=None):
self.decrypted = False
self.key = None
self.key_hash = None
self.hmacSalt = None
self.hmac = None
self.hmacComputed = N... | if self.decrypted or not pwdhash:
return
# Compute encryption key
cleartxt = crypto.dataDecrypt(self.cipherAlgo, self.hashAlgo, self.ciphertext, pwdhash, self.iv,
self.rounds)
self.key = cleartxt[-64:]
hmacSalt = cleartxt[:16]
... | """
Decrypts the masterkey with the given encryption key.
This function also extracts the HMAC part of the decrypted stuff and compare it with the computed one.
Note that, once successfully decrypted, the masterkey will not be decrypted anymore; this function will simply return.
... | 45 | 617 | 219 | 836 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
from . import crypto
from .credhist import CredHistFile
from .system import CredSystem
from .eater import DataStruct, Ea... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
from . import crypto
from .credhist import CredHistFile
from .system import CredSystem
from .eater import DataStruct, Ea... |
466 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/masterkey.py | 186,187 | 134,224 | jhash | MasterKeyFile | 191,224 | 187,224 | class MasterKeyFile(DataStruct):
"""
This class represents a masterkey file.
"""
def __init__(self, raw=None):
self.masterkey = None
self.backupkey = None
self.credhist = None
self.domainkey = None
self.decrypted = False
self.version = None
self.g... | class MasterKeyFile(DataStruct):
"""
This class represents a masterkey file.
"""
def __init__(self, raw=None):
self.masterkey = None
self.backupkey = None
self.credhist = None
self.domainkey = None
self.decrypted = False
self.version = None
self.g... | if 'des3' in str(self.masterkey.cipherAlgo).lower() and 'hmac' in str(self.masterkey.hashAlgo).lower():
version = 1
hmac_algo = 'sha1'
cipher_algo = 'des3'
elif 'aes-256' in str(self.masterkey.cipherAlgo).lower() and 'sha512' in str(self.masterkey.hashAlgo).lower():
... | """
Compute the hash used to be bruteforced.
From the masterkey field of the mk file => mk variable.
"""
if 'des3' in str(self.masterkey.cipherAlgo).lower() and 'hmac' in str(self.masterkey.hashAlgo).lower():
version = 1
hmac_algo = 'sha1'
ciph... | 77 | 627 | 460 | 1,087 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
from . import crypto
from .credhist import CredHistFile
from .system import CredSystem
from .eater import DataStruct, Ea... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
from . import crypto
from .credhist import CredHistFile
from .system import CredSystem
from .eater import DataStruct, Ea... |
468 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/system.py | 28,29 | 13,39 | parse | CredSystem | 36,39 | 29,39 | class CredSystem(DataStruct):
"""
This represents the DPAPI_SYSTEM token which is stored as an LSA secret.
Sets 2 properties:
self.machine
self.user
"""
def __init__(self, raw=None):
self.revision = None
self.machine = None
self.user = None
DataStruc... | class CredSystem(DataStruct):
"""
This represents the DPAPI_SYSTEM token which is stored as an LSA secret.
Sets 2 properties:
self.machine
self.user
"""
def __init__(self, raw=None):
self.revision = None
self.machine = None
self.user = None
DataStruc... | self.revision = data.eat("L")
self.machine = data.eat("20s")
self.user = data.eat("20s")
| """Parses the given data. May raise exceptions if incorrect data are
given. You should not call this function yourself; DataStruct does
data is a DataStruct object.
Returns nothing.
"""
self.revision = data.eat("L")
self.machine = data.eat("20s")
... | 9 | 171 | 47 | 218 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
from .eater import DataStruct
class CredSystem(DataStruct):
"""
This represents the DPAPI_SYSTEM token which... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
from .eater import DataStruct
class CredSystem(DataStruct):
"""
This represents the DPAPI_SYSTEM token which... |
469 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/vault.py | 422,423 | 380,492 | decrypt | Vault | 428,492 | 423,492 | class Vault(object):
"""
Contains all process to decrypt Vault files
"""
def __init__(self, vaults_dir):
self.vaults_dir = vaults_dir
def decrypt_vault_attribute(self, vault_attr, key_aes128, key_aes256):
"""
Helper to decrypt VAULT attributes.
"""
if not vau... | class Vault(object):
"""
Contains all process to decrypt Vault files
"""
def __init__(self, vaults_dir):
self.vaults_dir = vaults_dir
def decrypt_vault_attribute(self, vault_attr, key_aes128, key_aes256):
"""
Helper to decrypt VAULT attributes.
"""
if not vau... | vpol_filename = os.path.join(self.vaults_dir, 'Policy.vpol')
if not os.path.exists(vpol_filename):
return False, u'Policy file not found: {file}'.format(file=vpol_filename)
with open(vpol_filename, 'rb') as fin:
vpol = VaultPolicy(fin.read())
ok, vpol_decrypted ... | """
Decrypt one vault file
mkp represent the masterkeypool object
Very well explained here: http://blog.digital-forensics.it/2016/01/windows-revaulting.html
"""
vpol_filename = os.path.join(self.vaults_dir, 'Policy.vpol')
if not os.path.exists(vpol_filename):
... | 169 | 525 | 802 | 1,327 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... |
470 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/vault.py | 143,144 | 123,163 | parse | VaultAttribute | 144,163 | 144,163 | class VaultAttribute(DataStruct):
"""
This class contains the encrypted data we are looking for (data + iv)
"""
def __init__(self, raw=None):
self.id = None
self.attr_unknown_1 = None
self.attr_unknown_2 = None
self.attr_unknown_3 = None
self.padding = None
... | class VaultAttribute(DataStruct):
"""
This class contains the encrypted data we are looking for (data + iv)
"""
def __init__(self, raw=None):
self.id = None
self.attr_unknown_1 = None
self.attr_unknown_2 = None
self.attr_unknown_3 = None
self.padding = None
... | self.id = data.eat("L")
self.attr_unknown_1 = data.eat("L")
self.attr_unknown_2 = data.eat("L")
self.attr_unknown_3 = data.eat("L")
# self.padding = data.eat("6s")
if self.id >= 100:
self.attr_unknown_4 = data.eat("L")
self.size = data.eat("L")
... | self.id = data.eat("L")
self.attr_unknown_1 = data.eat("L")
self.attr_unknown_2 = data.eat("L")
self.attr_unknown_3 = data.eat("L")
# self.padding = data.eat("6s")
if self.id >= 100:
self.attr_unknown_4 = data.eat("L")
self.size = data.eat("L")
... | 63 | 196 | 280 | 476 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... |
471 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/vault.py | 175,176 | 163,181 | parse | VaultAttributeMapEntry | 176,181 | 176,181 | class VaultAttributeMapEntry(DataStruct):
"""
This class contains a pointer on VaultAttribute structure
"""
def __init__(self, raw=None):
self.id = None
self.offset = None
self.attr_map_entry_unknown_1 = None
self.pointer = None
self.extra_entry = None
Dat... | class VaultAttributeMapEntry(DataStruct):
"""
This class contains a pointer on VaultAttribute structure
"""
def __init__(self, raw=None):
self.id = None
self.offset = None
self.attr_map_entry_unknown_1 = None
self.pointer = None
self.extra_entry = None
Dat... | self.id = data.eat("L")
self.offset = data.eat("L")
self.attr_map_entry_unknown_1 = data.eat("L")
| self.id = data.eat("L")
self.offset = data.eat("L")
self.attr_map_entry_unknown_1 = data.eat("L")
| 9 | 117 | 54 | 171 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... |
472 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/vault.py | 101,102 | 79,123 | parse | VaultPolicy | 102,123 | 102,123 | class VaultPolicy(DataStruct):
"""
Policy.vpol file is a DPAPI blob with an header containing a textual description
and a GUID that should match the Vault folder name
Once the blob is decrypted, we get two AES keys to be used in decrypting the vcrd files.
"""
def __init__(self, raw=None):
... | class VaultPolicy(DataStruct):
"""
Policy.vpol file is a DPAPI blob with an header containing a textual description
and a GUID that should match the Vault folder name
Once the blob is decrypted, we get two AES keys to be used in decrypting the vcrd files.
"""
def __init__(self, raw=None):
... | self.version = data.eat("L")
self.guid = b"%0x-%0x-%0x-%0x%0x-%0x%0x%0x%0x%0x%0x" % data.eat("L2H8B") # data.eat("16s")
self.description = data.eat_length_and_string("L").replace(b"\x00", b"") # Unicode
self.unknown1 = data.eat("L")
self.unknown2 = data.eat("L")
self.un... | self.version = data.eat("L")
self.guid = b"%0x-%0x-%0x-%0x%0x-%0x%0x%0x%0x%0x%0x" % data.eat("L2H8B") # data.eat("16s")
self.description = data.eat_length_and_string("L").replace(b"\x00", b"") # Unicode
self.unknown1 = data.eat("L")
self.unknown2 = data.eat("L")
self.un... | 65 | 237 | 453 | 690 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... |
473 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/vault.py | 41,42 | 27,54 | parse | VaultPolicyKey | 42,54 | 42,54 | class VaultPolicyKey(DataStruct):
"""
Structure containing the AES key used to decrypt the vcrd files
"""
def __init__(self, raw=None):
# self.size = None
self.unknown1 = None
self.unknown2 = None
self.dwMagic = None
self.dwVersion = None
self.cbKeyData = ... | class VaultPolicyKey(DataStruct):
"""
Structure containing the AES key used to decrypt the vcrd files
"""
def __init__(self, raw=None):
# self.size = None
self.unknown1 = None
self.unknown2 = None
self.dwMagic = None
self.dwVersion = None
self.cbKeyData = ... | # self.size = data.eat("L")
self.unknown1 = data.eat("L")
self.unknown2 = data.eat("L")
self.dwMagic = data.eat("L") # Constant: 0x4d42444b
self.dwVersion = data.eat("L")
self.cbKeyData = data.eat("L")
if self.cbKeyData > 0:
# self.key = data.eat_sub(... | # self.size = data.eat("L")
self.unknown1 = data.eat("L")
self.unknown2 = data.eat("L")
self.dwMagic = data.eat("L") # Constant: 0x4d42444b
self.dwVersion = data.eat("L")
self.cbKeyData = data.eat("L")
if self.cbKeyData > 0:
# self.key = data.eat_sub(... | 35 | 136 | 172 | 308 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... |
474 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/vault.py | 67,68 | 54,79 | parse | VaultPolicyKeys | 68,79 | 68,79 | class VaultPolicyKeys(DataStruct):
"""
Structure containing two AES keys used to decrypt the vcrd files
- First key is an AES 128
- Second key is an AES 256
"""
def __init__(self, raw=None):
self.vpol_key1_size = None
self.vpol_key1 = None
self.vpol_key2_size = None
... | class VaultPolicyKeys(DataStruct):
"""
Structure containing two AES keys used to decrypt the vcrd files
- First key is an AES 128
- Second key is an AES 256
"""
def __init__(self, raw=None):
self.vpol_key1_size = None
self.vpol_key1 = None
self.vpol_key2_size = None
... | self.vpol_key1_size = data.eat("L")
if self.vpol_key1_size > 0:
self.vpol_key1 = VaultPolicyKey()
self.vpol_key1.parse(data.eat_sub(self.vpol_key1_size))
self.vpol_key2_size = data.eat("L")
if self.vpol_key2_size > 0:
self.vpol_key2 = VaultPolicyKey()... | self.vpol_key1_size = data.eat("L")
if self.vpol_key1_size > 0:
self.vpol_key1 = VaultPolicyKey()
self.vpol_key1.parse(data.eat_sub(self.vpol_key1_size))
self.vpol_key2_size = data.eat("L")
if self.vpol_key2_size > 0:
self.vpol_key2 = VaultPolicyKey()... | 22 | 151 | 170 | 321 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... |
475 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/vault.py | 355,356 | 339,368 | parse | VaultSchemaActiveSync | 356,368 | 356,368 | class VaultSchemaActiveSync(DataStruct):
"""
Active Sync Credential Schema
"""
def __init__(self, raw=None):
self.version = None
self.count = None
self.vault_schema_activesync_unknown1 = None
self.id_identity = None
self.identity = None
self.id_resource = ... | class VaultSchemaActiveSync(DataStruct):
"""
Active Sync Credential Schema
"""
def __init__(self, raw=None):
self.version = None
self.count = None
self.vault_schema_activesync_unknown1 = None
self.id_identity = None
self.identity = None
self.id_resource = ... | self.version = data.eat("L")
self.count = data.eat("L")
self.vault_schema_activesync_unknown1 = data.eat("L")
self.id_identity = data.eat("L")
self.identity = data.eat_length_and_string("L").replace(b"\x00", b"")
self.id_resource = data.eat("L")
self.resource = da... | self.version = data.eat("L")
self.count = data.eat("L")
self.vault_schema_activesync_unknown1 = data.eat("L")
self.id_identity = data.eat("L")
self.identity = data.eat_length_and_string("L").replace(b"\x00", b"")
self.id_resource = data.eat("L")
self.resource = da... | 35 | 153 | 221 | 374 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... |
476 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/vault.py | 255,256 | 244,276 | parse | VaultSchemaGeneric | 256,276 | 256,276 | class VaultSchemaGeneric(DataStruct):
"""
Generic Vault Schema
"""
def __init__(self, raw=None):
self.version = None
self.count = None
self.vault_schema_generic_unknown1 = None
self.attribute_item = []
DataStruct.__init__(self, raw)
def parse(self, data):
FIL... | class VaultSchemaGeneric(DataStruct):
"""
Generic Vault Schema
"""
def __init__(self, raw=None):
self.version = None
self.count = None
self.vault_schema_generic_unknown1 = None
self.attribute_item = []
DataStruct.__init__(self, raw)
def parse(self, data):
FIL... | self.version = data.eat("L")
self.count = data.eat("L")
self.vault_schema_generic_unknown1 = data.eat("L")
for i in range(self.count):
self.attribute_item.append(
VaultAttributeItem(
id_=data.eat("L"),
item=data.eat_leng... | self.version = data.eat("L")
self.count = data.eat("L")
self.vault_schema_generic_unknown1 = data.eat("L")
for i in range(self.count):
self.attribute_item.append(
VaultAttributeItem(
id_=data.eat("L"),
item=data.eat_leng... | 38 | 105 | 197 | 302 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... |
477 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/vault.py | 295,296 | 276,311 | parse | VaultSchemaPin | 296,311 | 296,311 | class VaultSchemaPin(DataStruct):
"""
PIN Logon Vault Resource Schema
"""
def __init__(self, raw=None):
self.version = None
self.count = None
self.vault_schema_pin_unknown1 = None
self.id_sid = None
self.sid_len = None
self.sid = None
self.id_resou... | class VaultSchemaPin(DataStruct):
"""
PIN Logon Vault Resource Schema
"""
def __init__(self, raw=None):
self.version = None
self.count = None
self.vault_schema_pin_unknown1 = None
self.id_sid = None
self.sid_len = None
self.sid = None
self.id_resou... | self.version = data.eat("L")
self.count = data.eat("L")
self.vault_schema_pin_unknown1 = data.eat("L")
self.id_sid = data.eat("L")
self.sid_len = data.eat("L")
if self.sid_len > 0:
self.sid = data.eat_sub(self.sid_len)
self.id_resource = data.eat("L")
... | self.version = data.eat("L")
self.count = data.eat("L")
self.vault_schema_pin_unknown1 = data.eat("L")
self.id_sid = data.eat("L")
self.sid_len = data.eat("L")
if self.sid_len > 0:
self.sid = data.eat_sub(self.sid_len)
self.id_resource = data.eat("L")
... | 44 | 175 | 261 | 436 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... |
478 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/vault.py | 327,328 | 311,339 | parse | VaultSchemaWebPassword | 328,339 | 328,339 | class VaultSchemaWebPassword(DataStruct):
"""
Windows Web Password Credential Schema
"""
def __init__(self, raw=None):
self.version = None
self.count = None
self.vault_schema_web_password_unknown1 = None
self.id_identity = None
self.identity = None
self.id... | class VaultSchemaWebPassword(DataStruct):
"""
Windows Web Password Credential Schema
"""
def __init__(self, raw=None):
self.version = None
self.count = None
self.vault_schema_web_password_unknown1 = None
self.id_identity = None
self.identity = None
self.id... | self.version = data.eat("L")
self.count = data.eat("L")
self.vault_schema_web_password_unknown1 = data.eat("L")
self.id_identity = data.eat("L")
self.identity = data.eat_length_and_string("L").replace(b"\x00", b"")
self.id_resource = data.eat("L")
self.resource = ... | self.version = data.eat("L")
self.count = data.eat("L")
self.vault_schema_web_password_unknown1 = data.eat("L")
self.id_identity = data.eat("L")
self.identity = data.eat_length_and_string("L").replace(b"\x00", b"")
self.id_resource = data.eat("L")
self.resource = ... | 30 | 154 | 204 | 358 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... |
479 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/vault.py | 197,198 | 181,217 | parse | VaultVcrd | 198,217 | 198,217 | class VaultVcrd(DataStruct):
"""
vcrd files contain encrypted attributes encrypted with the previous AES keys which represents the target secret
"""
def __init__(self, raw=None):
self.schema_guid = None
self.vcrd_unknown_1 = None
self.last_update = None
self.vcrd_unknown_... | class VaultVcrd(DataStruct):
"""
vcrd files contain encrypted attributes encrypted with the previous AES keys which represents the target secret
"""
def __init__(self, raw=None):
self.schema_guid = None
self.vcrd_unknown_1 = None
self.last_update = None
self.vcrd_unknown_... | self.schema_guid = b"%0x-%0x-%0x-%0x%0x-%0x%0x%0x%0x%0x%0x" % data.eat("L2H8B") # data.eat("16s")
self.vcrd_unknown_1 = data.eat("L")
self.last_update = data.eat("Q")
self.vcrd_unknown_2 = data.eat("L")
self.vcrd_unknown_3 = data.eat("L")
self.description = data.eat_leng... | self.schema_guid = b"%0x-%0x-%0x-%0x%0x-%0x%0x%0x%0x%0x%0x" % data.eat("L2H8B") # data.eat("16s")
self.vcrd_unknown_1 = data.eat("L")
self.last_update = data.eat("Q")
self.vcrd_unknown_2 = data.eat("L")
self.vcrd_unknown_3 = data.eat("L")
self.description = data.eat_leng... | 62 | 170 | 341 | 511 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... |
480 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/DPAPI/vault.py | 230,231 | 217,238 | parse | VaultVsch | 231,238 | 231,238 | class VaultVsch(DataStruct):
"""
Vault Schemas
Vault file partial parsing
"""
def __init__(self, raw=None):
self.version = None
self.schema_guid = None
self.vault_vsch_unknown_1 = None
self.count = None
self.schema_name = None
DataStruct.__init__(self,... | class VaultVsch(DataStruct):
"""
Vault Schemas
Vault file partial parsing
"""
def __init__(self, raw=None):
self.version = None
self.schema_guid = None
self.vault_vsch_unknown_1 = None
self.count = None
self.schema_name = None
DataStruct.__init__(self,... | self.version = data.eat("L")
self.schema_guid = b"%0x-%0x-%0x-%0x%0x-%0x%0x%0x%0x%0x%0x" % data.eat("L2H8B")
self.vault_vsch_unknown_1 = data.eat("L")
self.count = data.eat("L")
self.schema_name = data.eat_length_and_string("L").replace(b"\x00", b"")
| self.version = data.eat("L")
self.schema_guid = b"%0x-%0x-%0x-%0x%0x-%0x%0x%0x%0x%0x%0x" % data.eat("L2H8B")
self.vault_vsch_unknown_1 = data.eat("L")
self.count = data.eat("L")
self.schema_name = data.eat_length_and_string("L").replace(b"\x00", b"")
| 18 | 121 | 150 | 271 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code based from these two awesome projects:
- DPAPICK : https://bitbucket.org/jmichel/dpapick
- DPAPILAB : https://github.com/dfirfpi/dpapilab
"""
import codecs
import struct
from .blob import DPAPIBlob
from .eater import DataStruct, Eater
from lazagne.config.cry... |
481 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/change_privileges.py | 111,112 | 1,221 | get_sid_token | 112,158 | 112,158 | # -*- coding: utf-8 -*-
# Original code from https://github.com/joren485/PyWinPrivEsc/blob/master/RunAsSystem.py
import sys
import traceback
from lazagne.config.write_output import print_debug
from lazagne.config.winstructure import *
import os
def get_token_info(hToken):
"""
Retrieve SID and user owner fr... | # -*- coding: utf-8 -*-
# Original code from https://github.com/joren485/PyWinPrivEsc/blob/master/RunAsSystem.py
import sys
import traceback
from lazagne.config.write_output import print_debug
from lazagne.config.winstructure import *
import os
def get_token_info(hToken):
"""
Retrieve SID and user owner fr... | if token_sid == "S-1-5-18":
sids = list_sids()
for sid in sids:
if "winlogon" in sid[1].lower():
try:
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, sid[0])
if hProcess:
hToken = HANDLE(INVALID_HAND... | if token_sid == "S-1-5-18":
sids = list_sids()
for sid in sids:
if "winlogon" in sid[1].lower():
try:
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, sid[0])
if hProcess:
hToken = HANDLE(INVALID_HAND... | 110 | 1,532 | 490 | 2,022 | # -*- coding: utf-8 -*-
# Original code from https://github.com/joren485/PyWinPrivEsc/blob/master/RunAsSystem.py
import sys
import traceback
from lazagne.config.write_output import print_debug
from lazagne.config.winstructure import *
import os
def get_token_info(hToken):
"""
Retrieve SID and user owner fr... | # -*- coding: utf-8 -*-
# Original code from https://github.com/joren485/PyWinPrivEsc/blob/master/RunAsSystem.py
import sys
import traceback
from lazagne.config.write_output import print_debug
from lazagne.config.winstructure import *
import os
def get_token_info(hToken):
"""
Retrieve SID and user owner fr... | |
483 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/crypto/pyaes/blockfeeder.py | 156,157 | 144,186 | feed | BlockFeeder | 163,186 | 157,186 | class BlockFeeder(object):
'''The super-class for objects to handle chunking a stream of bytes
into the appropriate block size for the underlying mode of operation
and applying (or stripping) padding, as necessary.'''
def __init__(self, mode, feed, final, padding = PADDING_DEFAULT):
self.... | class BlockFeeder(object):
'''The super-class for objects to handle chunking a stream of bytes
into the appropriate block size for the underlying mode of operation
and applying (or stripping) padding, as necessary.'''
def __init__(self, mode, feed, final, padding = PADDING_DEFAULT):
self.... |
if self._buffer is None:
raise ValueError('already finished feeder')
# Finalize; process the spare bytes we were keeping
if data is None:
result = self._final(self._buffer, self._padding)
self._buffer = None
return result
self._buffer +=... | '''Provide bytes to encrypt (or decrypt), returning any bytes
possible from this or any previous calls to feed.
Call with None or an empty string to flush the mode of
operation and return any final bytes; no further calls to
feed may be made.'''
if self._buf... | 69 | 205 | 222 | 427 | # The MIT License (MIT)
#
# Copyright (c) 2014 Richard Moore
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... | # The MIT License (MIT)
#
# Copyright (c) 2014 Richard Moore
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... |
484 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/crypto/rc4.py | 33,34 | 7,58 | crypt | RC4 | 34,58 | 34,58 | class RC4(object):
def __init__(self, key):
self.key_bytes = self.text_to_bytes(key)
def text_to_bytes(self, text):
byte_list = []
# on Windows, default coding for Chinese is GBK
# s = s.decode('gbk').encode('utf-8')
for byte in text:
byte_list.append(char_... | class RC4(object):
def __init__(self, key):
self.key_bytes = self.text_to_bytes(key)
def text_to_bytes(self, text):
byte_list = []
# on Windows, default coding for Chinese is GBK
# s = s.decode('gbk').encode('utf-8')
for byte in text:
byte_list.append(char_... |
keystream_list = []
cipher_list = []
key_len = len(key_bytes)
plain_len = len(plain_bytes)
S = list(range(256))
j = 0
for i in range(256):
j = (j + S[i] + key_bytes[i % key_len]) % 256
S[i], S[j] = S[j], S[i]
i = 0
j = 0... |
keystream_list = []
cipher_list = []
key_len = len(key_bytes)
plain_len = len(plain_bytes)
S = list(range(256))
j = 0
for i in range(256):
j = (j + S[i] + key_bytes[i % key_len]) % 256
S[i], S[j] = S[j], S[i]
i = 0
j = 0... | 81 | 263 | 276 | 539 | # Thanks to g2jun for his RC4-Python project
# Code from https://github.com/g2jun/RC4-Python
from lazagne.config.winstructure import char_to_int, chr_or_byte
class RC4(object):
def __init__(self, key):
self.key_bytes = self.text_to_bytes(key)
def text_to_bytes(self, text):
byte_list = []
... | # Thanks to g2jun for his RC4-Python project
# Code from https://github.com/g2jun/RC4-Python
from lazagne.config.winstructure import char_to_int, chr_or_byte
class RC4(object):
def __init__(self, key):
self.key_bytes = self.text_to_bytes(key)
def text_to_bytes(self, text):
byte_list = []
... |
486 | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne | /home/hieuvd/dung_repo/raw/stars_01/AlessandroZ_LaZagne/LaZagne/Windows/lazagne/config/execute_cmd.py | 20,21 | 1,101 | powershell_execute | 24,67 | 21,67 | # -*- coding: utf-8 -*-
# !/usr/bin/python
import base64
import os
import subprocess
import re
from lazagne.config.write_output import print_debug
from lazagne.config.constant import constant
try:
import _subprocess as sub
STARTF_USESHOWWINDOW = sub.STARTF_USESHOWWINDOW # Not work on Python 3
SW_HIDE = ... | # -*- coding: utf-8 -*-
# !/usr/bin/python
import base64
import os
import subprocess
import re
from lazagne.config.write_output import print_debug
from lazagne.config.constant import constant
try:
import _subprocess as sub
STARTF_USESHOWWINDOW = sub.STARTF_USESHOWWINDOW # Not work on Python 3
SW_HIDE = ... | output = ""
try:
script = re.sub("Write-Verbose ", "Write-Output ", script, flags=re.I)
script = re.sub("Write-Error ", "Write-Output ", script, flags=re.I)
script = re.sub("Write-Warning ", "Write-Output ", script, flags=re.I)
full_args = ["powershell.exe", "-NoProfile", "-NoLo... | """
Execute a powershell script
"""
output = ""
try:
script = re.sub("Write-Verbose ", "Write-Output ", script, flags=re.I)
script = re.sub("Write-Error ", "Write-Output ", script, flags=re.I)
script = re.sub("Write-Warning ", "Write-Output ", script, flags=re.I)
ful... | 135 | 601 | 654 | 1,255 | # -*- coding: utf-8 -*-
# !/usr/bin/python
import base64
import os
import subprocess
import re
from lazagne.config.write_output import print_debug
from lazagne.config.constant import constant
try:
import _subprocess as sub
STARTF_USESHOWWINDOW = sub.STARTF_USESHOWWINDOW # Not work on Python 3
SW_HIDE = ... | # -*- coding: utf-8 -*-
# !/usr/bin/python
import base64
import os
import subprocess
import re
from lazagne.config.write_output import print_debug
from lazagne.config.constant import constant
try:
import _subprocess as sub
STARTF_USESHOWWINDOW = sub.STARTF_USESHOWWINDOW # Not work on Python 3
SW_HIDE = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.