text stringlengths 0 93.6k |
|---|
item["negative_prompt"] = quote_js("") |
if negative_prompt: |
item["negative_prompt"] = quote_js('(' + negative_prompt + ':1)') |
sd_version = item["user_metadata"].get("sd version") |
if sd_version in network.SdVersion.__members__: |
item["sd_version"] = sd_version |
sd_version = network.SdVersion[sd_version] |
else: |
sd_version = lora_on_disk.sd_version |
if shared.opts.lyco_show_all or not enable_filter: |
pass |
elif sd_version == network.SdVersion.Unknown: |
model_version = network.SdVersion.SDXL if shared.sd_model.is_sdxl else network.SdVersion.SD2 if shared.sd_model.is_sd2 else network.SdVersion.SD1 |
if model_version.name in shared.opts.lyco_hide_unknown_for_versions: |
return None |
elif shared.sd_model.is_sdxl and sd_version != network.SdVersion.SDXL: |
return None |
elif shared.sd_model.is_sd2 and sd_version != network.SdVersion.SD2: |
return None |
elif shared.sd_model.is_sd1 and sd_version != network.SdVersion.SD1: |
return None |
return item |
def list_items(self): |
# instantiate a list to protect against concurrent modification |
names = list(networks.available_networks) |
for index, name in enumerate(names): |
item = self.create_item(name, index) |
if item is not None: |
yield item |
def allowed_directories_for_previews(self): |
return [shared.cmd_opts.lyco_dir, shared.cmd_opts.lora_dir] |
def create_user_metadata_editor(self, ui, tabname): |
return LoraUserMetadataEditor(ui, tabname, self) |
# <FILESEP> |
#! /usr/bin/python |
import importlib |
import json |
import logging |
import os |
import shutil |
import time |
# Initialize the machines |
from conf.config import ACTIVE_MACHINE_TYPE, MACHINE_INDEX, VOLATILITYBOT_HOME, CODE_EXTRACTORS |
from lib.common.pslist import get_new_pslist |
from lib.core.memory import MemoryDump |
machine = importlib.import_module('machines.{}'.format(ACTIVE_MACHINE_TYPE.lower())) |
machine_class = getattr(machine, ACTIVE_MACHINE_TYPE) |
machine_dict = {} |
for machine_instance in MACHINE_INDEX: |
machine_dict[machine_instance] = machine_class(machine_instance) |
machine_dict[machine_instance].initialize() |
machine_dict[machine_instance].show_info() |
for vm in MACHINE_INDEX: |
logging.info("[*] VM name: %s Enabled: %s" % (machine_dict[vm].machine_name, machine_dict[vm].active)) |
if machine_dict[vm].active: |
print(' [*] [{}] Creating Golden image for this machine!'.format(machine_dict[vm].machine_name)) |
print("[*] Reverting Machine...") |
machine_dict[vm].revert() |
machine_dict[vm].start() |
print("[*] Sleeping 5 seconds...") |
time.sleep(5) |
print("[*] Suspending Machine...") |
machine_dict[vm].suspend() |
print("[*] Acquiring memory...") |
memdump = MemoryDump(machine_dict[vm].get_memory_path()) |
memdump.profile = machine_dict[vm].memory_profile |
gi_dir = os.path.join(VOLATILITYBOT_HOME, 'GoldenImage', machine_dict[vm].machine_name) |
if os.path.exists(gi_dir): |
print("[*] Folder already exists, deleting and recreating") |
shutil.rmtree(gi_dir) |
os.mkdir(gi_dir) |
else: |
print("[*] Folder does not exist, recreating") |
os.mkdir(gi_dir) |
print("[*] Executing Golden Image modules") |
for code_extractor_name in CODE_EXTRACTORS: |
print('[*] Starting code extractor of {}'.format(code_extractor_name)) |
extractor = importlib.import_module('code_extractors.{}'.format(code_extractor_name)) |
create_golden_image_func = getattr(extractor, 'create_golden_image') |
with open(os.path.join(gi_dir, code_extractor_name + '.json'),'w+') as golden_image_file: |
golden_image_file.write(json.dumps(create_golden_image_func(memdump), indent=4)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.