Autosave: 20260302-173002

This commit is contained in:
Flatlogic Bot 2026-03-02 17:30:02 +00:00
parent 2e85c01115
commit 6d5f26a42c
12 changed files with 715 additions and 0 deletions

52
apply_patch.py Normal file
View File

@ -0,0 +1,52 @@
import re
with open('_get_instance_details.php', 'r') as f:
content = f.read()
pattern = re.compile(r"<\?php foreach \(\dcurrentNode\['ui_hints'\]\['form_schema'\].*?endforeach;\s*\?>", re.DOTALL)
replacement_text = r"""<?php foreach ($currentNode['ui_hints']['form_schema'] as $field):
$fieldName = $field['name'];
$currentValue = $instanceData[$fieldName] ?? null;
?>
<?php if ($field['type'] === 'checkbox'): ?>
<div class="form-check mb-3">
<input type="hidden" name="<?= $fieldName ?>" value="0">
<input type="checkbox" id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-check-input" value="1" <?= (!empty($currentValue) || (!isset($currentValue) && !empty($field['default']))) ? 'checked' : '' ?>>
<label for="<?= $fieldName ?>" class="form-check-label"><?= $field['label'] ?></label>
</div>
<?php else: ?>
<div class="mb-3">
<label for="<?= $fieldName ?>" class="form-label"><?= $field['label'] ?></label>
<?php if ($field['type'] === 'textarea'): ?>
<textarea id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-control"><?= htmlspecialchars((string)($currentValue ?? '')) ?></textarea>
<?php elseif ($field['type'] === 'select'): ?>
<select id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-select">
<?php foreach ($field['options'] as $option):
$selected = ($currentValue !== null && (string)$currentValue === (string)$option['value']) ? 'selected' : '';
?>
<option value="<?= $option['value'] ?>" <?= $selected ?>><?= $option['label'] ?></option>
<?php endforeach; ?>
</select>
<?php else: ?>
<?php
$defaultVal = ($field['default'] ?? '') === 'now' ? date('Y-m-d\\TH:i') : ($field['default'] ?? '');
$valToUse = $currentValue ?? $defaultVal;
?>
<input type="<?= $field['type'] ?>" id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-control" value="<?= htmlspecialchars((string)$valToUse) ?>">
<?php endif; ?>
</div>
<?php endif; ?>
<?php endforeach; ?>"""
def replacer(match):
return replacement_text
matches = pattern.search(content)
if matches:
content = pattern.sub(replacer, content, count=1)
with open('_get_instance_details.php', 'w') as f:
f.write(content)
print("Patched successfully!")
else:
print("Pattern not found!")

63
do_patch.py Normal file
View File

@ -0,0 +1,63 @@
import re
with open('_get_instance_details.php', 'r') as f:
content = f.read()
old_block = """ <?php foreach ($currentNode['ui_hints']['form_schema'] as $field): ?>
<div class="mb-3">
<label for="<?= $field['name'] ?>" class="form-label"><?= $field['label'] ?></label>
<?php if ($field['type'] === 'textarea'): ?>
<textarea id="<?= $field['name'] ?>" name="<?= $field['name'] ?>" class="form-control"></textarea>
<?php elseif ($field['type'] === 'select'): ?>
<select id="<?= $field['name'] ?>" name="<?= $field['name'] ?>" class="form-select">
<?php foreach ($field['options'] as $option): ?>
<option value="<?= $option['value'] ?>"><?= $option['label'] ?></option>
<?php endforeach; ?>
</select>
<?php else: ?>
<input type="<?= $field['type'] ?>" id="<?= $field['name'] ?>" name="<?= $field['name'] ?>" class="form-control" value="<?= ($field['default'] ?? '') === 'now' ? date('Y-m-d\\TH:i') : '' ?>">
<?php endif; ?>
</div>
<?php endforeach; ?>"""
new_block = """ <?php foreach ($currentNode['ui_hints']['form_schema'] as $field):
$fieldName = $field['name'];
$currentValue = $instanceData[$fieldName] ?? null;
?>
<?php if ($field['type'] === 'checkbox'): ?>
<div class="form-check mb-3">
<input type="hidden" name="<?= $fieldName ?>" value="0">
<input type="checkbox" id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-check-input" value="1" <?= (!empty($currentValue) || (!isset($currentValue) && !empty($field['default']))) ? 'checked' : '' ?>>
<label for="<?= $fieldName ?>" class="form-check-label"><?= $field['label'] ?></label>
</div>
<?php else: ?>
<div class="mb-3">
<label for="<?= $fieldName ?>" class="form-label"><?= $field['label'] ?></label>
<?php if ($field['type'] === 'textarea'): ?>
<textarea id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-control"><?= htmlspecialchars((string)($currentValue ?? '')) ?></textarea>
<?php elseif ($field['type'] === 'select'): ?>
<select id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-select">
<?php foreach ($field['options'] as $option):
$selected = ($currentValue !== null && (string)$currentValue === (string)$option['value']) ? 'selected' : '';
?>
<option value="<?= $option['value'] ?>" <?= $selected ?>><?= $option['label'] ?></option>
<?php endforeach; ?>
</select>
<?php else: ?>
<?php
$defaultVal = ($field['default'] ?? '') === 'now' ? date('Y-m-d\\TH:i') : ($field['default'] ?? '');
$valToUse = $currentValue ?? $defaultVal;
?>
<input type="<?= $field['type'] ?>" id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-control" value="<?= htmlspecialchars((string)$valToUse) ?>">
<?php endif; ?>
</div>
<?php endif; ?>
<?php endforeach; ?>"""
if old_block in content:
content = content.replace(old_block, new_block)
with open('_get_instance_details.php', 'w') as f:
f.write(content)
print("Patched successfully")
else:
print("Old block not found!")

53
do_patch_base64.py Normal file
View File

@ -0,0 +1,53 @@
import re
with open('_get_instance_details.php', 'r') as f:
content = f.read()
pattern = re.compile(r"<\?php foreach \(\dcurrentNode\['ui_hints'\]\['form_schema'\] as \$field\): \?>(.*?)<\?php endforeach; \?>", re.DOTALL)
# use a function for replacement so it doesnt parse backslashes
replacement_text = r"""<?php foreach ($currentNode['ui_hints']['form_schema'] as $field):
$fieldName = $field['name'];
$currentValue = $instanceData[$fieldName] ?? null;
?>
<?php if ($field['type'] === 'checkbox'): ?>
<div class="form-check mb-3">
<input type="hidden" name="<?= $fieldName ?>" value="0">
<input type="checkbox" id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-check-input" value="1" <?= (!empty($currentValue) || (!isset($currentValue) && !empty($field['default']))) ? 'checked' : '' ?>>
<label for="<?= $fieldName ?>" class="form-check-label"><?= $field['label'] ?></label>
</div>
<?php else: ?>
<div class="mb-3">
<label for="<?= $fieldName ?>" class="form-label"><?= $field['label'] ?></label>
<?php if ($field['type'] === 'textarea'): ?>
<textarea id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-control"><?= htmlspecialchars((string)($currentValue ?? '')) ?></textarea>
<?php elseif ($field['type'] === 'select'): ?>
<select id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-select">
<?php foreach ($field['options'] as $option):
$selected = ($currentValue !== null && (string)$currentValue === (string)$option['value']) ? 'selected' : '';
?>
<option value="<?= $option['value'] ?>" <?= $selected ?>><?= $option['label'] ?></option>
<?php endforeach; ?>
</select>
<?php else: ?>
<?ph`
$defaultVal = ($field['default'] ?? '') === 'now' ? date('Y-m-d\\TH:i') : ($field['default'] ?? '');
$valToUse = $currentValue ?? $defaultVal;
?>
<input type="<?= $field['type'] ?>" id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-control" value="<?= htmlspecialchars((string)$valToUse) ?>">
<?php endif; ?>
</div>
<?php endif; ?>
<?php endforeach; ?>"""
def replacer(match):
return replacement_text
matches = pattern.search(content)
if matches:
content = pattern.sub(replacer, content, count=1)
with open('_get_instance_details.php', 'w') as f:
f.write(content)
print("Patched successfully!")
else:
print("Pattern not found!")

48
do_patch_final.py Normal file
View File

@ -0,0 +1,48 @@
import re
with open('_get_instance_details.php', 'r') as f:
content = f.read()
pattern = re.compile(r"<\?php foreach \(\dcurrentNode\['ui_hints'\]\['form_schema'\] as \$field\): \?>(.*?)<\?php endforeach; \?>", re.DOTALL)
replacement = r"""<?php foreach ($currentNode['ui_hints']['form_schema'] as $field):
$fieldName = $field['name'];
$currentValue = $instanceData[$fieldName] ?? null;
?>
<?php if ($field['type'] === 'checkbox'): ?>
<div class="form-check mb-3">
<input type="hidden" name="<?= $fieldName ?>" value="0">
<input type="checkbox" id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-check-input" value="1" <?= (!empty($currentValue) || (!isset($currentValue) && !empty($field['default']))) ? 'checked' : '' ?>>
<label for="<?= $fieldName ?>" class="form-check-label"><?= $field['label'] ?></label>
</div>
<?php else: ?>
<div class="mb-3">
<label for="<?= $fieldName ?>" class="form-label"><?= $field['label'] ?></label>
<?php if ($field['type'] === 'textarea'): ?>
<textarea id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-control"><?= htmlspecialchars((string)($currentValue ?? '')) ?></textarea>
<?php elseif ($field['type'] === 'select'): ?>
<select id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-select">
<?php foreach ($field['options'] as $option):
$selected = ($currentValue !== null && (string)$currentValue === (string)$option['value']) ? 'selected' : '';
?>
<option value="<?= $option['value'] ?>" <?= $selected ?>><?= $option['label'] ?></option>
<?php endforeach; ?>
</select>
<?php else: ?>
<?php
$defaultVal = ($field['default'] ?? '') === 'now' ? date('Y-m-d\\TH:i') : ($field['default'] ?? '');
$valToUse = $currentValue ?? $defaultVal;
?>
<input type="<?= $field['type'] ?>" id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-control" value="<?= htmlspecialchars((string)$valToUse) ?>">
<?php endif; ?>
</div>
<?php endif; ?>
<?php endforeach; ?>"""
if pattern.search(content):
content = pattern.sub(lambda m: replacement, content, count=1)
with open('_get_instance_details.php', 'w') as f:
f.write(content)
print("Patched successfully!")
else:
print("Pattern not found!")

67
patch_modal.php Normal file
View File

@ -0,0 +1,67 @@
<?php
$file = '_get_instance_details.php';
$content = file_get_contents($file);
$old = <<<HTML
<?php foreach ($currentNode['ui_hints']['form_schema'] as $field): ?>
<div class="mb-3">
<label for="<?= $field['name'] ?>" class="form-label"><?= $field['label'] ?></label>
<?php if ($field['type'] === 'textarea'): ?>
<textarea id="<?= $field['name'] ?>" name="<?= $field['name'] ?>" class="form-control"></textarea>
<?php elseif ($field['type'] === 'select'): ?>
<select id="<?= $field['name'] ?>" name="<?= $field['name'] ?>" class="form-select">
<?php foreach ($field['options'] as $option): ?>
<option value="<?= $option['value'] ?>"><?= $option['label'] ?></option>
<?php endforeach; ?>
</select>
<?php else: ?>
<input type="<?= $field['type'] ?>" id="<?= $field['name'] ?>" name="<?= $field['name'] ?>" class="form-control" value="<?= ($field['default'] ?? '') === 'now' ? date('Y-m-d\TH:i') : '' ?>">
<?php endif; ?>
</div>
<?php endforeach; ?>
HTML;
$new = <<<HTML
<?php foreach ($currentNode['ui_hints']['form_schema'] as $field):
$fieldName = $field['name'];
$currentValue = $instanceData[$fieldName] ?? null;
?>
<?php if ($field['type'] === 'checkbox'): ?>
<div class="form-check mb-3">
<input type="hidden" name="<?= $fieldName ?>" value="0">
<input type="checkbox" id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-check-input" value="1" <?= (!empty($currentValue) || (!isset($currentValue) && !empty($field['default']))) ? 'checked' : '' ?>>
<label for="<?= $fieldName ?>" class="form-check-label"><?= $field['label'] ?></label>
</div>
<?php else: ?>
<div class="mb-3">
<label for="<?= $fieldName ?>" class="form-label"><?= $field['label'] ?></label>
<?php if ($field['type'] === 'textarea'): ?>
<textarea id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-control"><?= htmlspecialchars((string)($currentValue ?? '')) ?></textarea>
<?php elseif ($field['type'] === 'select'): ?>
<select id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-select">
<?php foreach ($field['options'] as $option):
$selected = ($currentValue !== null && (string)$currentValue === (string)$option['value']) ? 'selected' : '';
?>
<option value="<?= $option['value'] ?>" <?= $selected ?>><?= $option['label'] ?></option>
<?php endforeach; ?>
</select>
<?php else: ?>
<?php
$defaultVal = ($field['default'] ?? '') === 'now' ? date('Y-m-d\TH:i') : ($field['default'] ?? '');
$valToUse = $currentValue ?? $defaultVal;
?>
<input type="<?= $field['type'] ?>" id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-control" value="<?= htmlspecialchars((string)$valToUse) ?>">
<?php endif; ?>
</div>
<?php endif; ?>
<?php endforeach; ?>
HTML;
$new_content = str_replace($old, $new, $content);
if ($new_content !== $content) {
file_put_contents($file, $new_content);
echo "Patched successfully!\n";
} else {
echo "Old block not found!\n";
}

63
patch_modal.py Normal file
View File

@ -0,0 +1,63 @@
import re
with open('_get_instance_details.php', 'r') as f:
content = f.read()
old_block = " <?php foreach ($currentNode['ui_hints']['form_schema'] as $field): ?>
<div class="mb-3">
<label for="<?= $field['name'] ?>" class="form-label"><?= $field['label'] ?></label>
<?php if ($field['type'] === 'textarea'): ?>
<textarea id="<?= $field['name'] ?>" name="<?= $field['name'] ?>" class="form-control"></textarea>
<?php elseif ($field['type'] === 'select'): ?>
<select id="<?= $field['name'] ?>" name="<?= $field['name'] ?>" class="form-select">
<?php foreach ($field['options'] as $option): ?>
<option value="<?= $option['value'] ?>"><?= $option['label'] ?></option>
<?php endforeach; ?>
</select>
<?php else: ?>
<input type="<?= $field['type'] ?>" id="<?= $field['name'] ?>" name="<?= $field['name'] ?>" class="form-control" value="<?= ($field['default'] ?? '') === 'now' ? date('Y-m-d\TH:i') : '' ?>">
<?php endif; ?>
</div>
<?php endforeach; ?>"
new_block = " <?php foreach ($currentNode['ui_hints']['form_schema'] as $field):
$fieldName = $field['name'];
$currentValue = $instanceData[$fieldName] ?? null;
?>
<?php if ($field['type'] === 'checkbox'): ?>
<div class="form-check mb-3">
<input type="hidden" name="<?= $fieldName ?>" value="0">
<input type="checkbox" id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-check-input" value="1" <?= (!empty($currentValue) || (!isset($currentValue) && !empty($field['default']))) ? 'checked' : '' ?>>
<label for="<?= $fieldName ?>" class="form-check-label"><?= $field['label'] ?></label>
</div>
<?php else: ?>
<div class="mb-3">
<label for="<?= $fieldName ?>" class="form-label"><?= $field['label'] ?></label>
<?php if ($field['type'] === 'textarea'): ?>
<textarea id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-control"><?= htmlspecialchars((string)($currentValue ?? '')) ?></textarea>
<?php elseif ($field['type'] === 'select'): ?>
<select id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-select">
<?php foreach ($field['options'] as $option):
$selected = ($currentValue !== null && (string)$currentValue === (string)$option['value']) ? 'selected' : '';
?>
<option value="<?= $option['value'] ?>" <?= $selected ?>><?= $option['label'] ?></option>
<?php endforeach; ?>
</select>
<?php else: ?>
<?php
$defaultVal = ($field['default'] ?? '') === 'now' ? date('Y-m-d\\TH:i') : ($field['default'] ?? '');
$valToUse = $currentValue ?? $defaultVal;
?>
<input type="<?= $field['type'] ?>" id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-control" value="<?= htmlspecialchars((string)$valToUse) ?>">
<?php endif; ?>
</div>
<?php endif; ?>
<?php endforeach; ?>"
if old_block in content:
content = content.replace(old_block, new_block)
with open('_get_instance_details.php', 'w') as f:
f.write(content)
print("Patched successfully")
else:
print("Old block not found!")

63
patch_modal2.py Normal file
View File

@ -0,0 +1,63 @@
import re
with open('_get_instance_details.php', 'r') as f:
content = f.read()
old_block = " <?php foreach ($currentNode['ui_hints']['form_schema'] as $field): ?>
<div class="mb-3">
<label for="<?= $field['name'] ?>" class="form-label"><?= $field['label'] ?></label>
<?php if ($field['type'] === 'textarea'): ?>
<textarea id="<?= $field['name'] ?>" name="<?= $field['name'] ?>" class="form-control"></textarea>
<?php elseif ($field['type'] === 'select'): ?>
<select id="<?= $field['name'] ?>" name="<?= $field['name'] ?>" class="form-select">
<?php foreach ($field['options'] as $option): ?>
<option value="<?= $option['value'] ?>"><?= $option['label'] ?></option>
<?php endforeach; ?>
</select>
<?php else: ?>
<input type="<?= $field['type'] ?>" id="<?= $field['name'] ?>" name="<?= $field['name'] ?>" class="form-control" value="<?= ($field['default'] ?? '') === 'now' ? date('Y-m-d\TH:i') : '' ?>">
<?php endif; ?>
</div>
<?php endforeach; ?>"
new_block = " <?php foreach ($currentNode['ui_hints']['form_schema'] as $field):
$fieldName = $field['name'];
$currentValue = $instanceData[$fieldName] ?? null;
?>
<?php if ($field['type'] === 'checkbox'): ?>
<div class="form-check mb-3">
<input type="hidden" name="<?= $fieldName ?>" value="0">
<input type="checkbox" id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-check-input" value="1" <?= (!empty($currentValue) || (!isset($currentValue) && !empty($field['default']))) ? 'checked' : '' ?>>
<label for="<?= $fieldName ?>" class="form-check-label"><?= $field['label'] ?></label>
</div>
<?php else: ?>
<div class="mb-3">
<label for="<?= $fieldName ?>" class="form-label"><?= $field['label'] ?></label>
<?php if ($field['type'] === 'textarea'): ?>
<textarea id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-control"><?= htmlspecialchars((string)($currentValue ?? '')) ?></textarea>
<?php elseif ($field['type'] === 'select'): ?>
<select id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-select">
<?php foreach ($field['options'] as $option):
$selected = ($currentValue !== null && (string)$currentValue === (string)$option['value']) ? 'selected' : '';
?>
<option value="<?= $option['value'] ?>" <?= $selected ?>><?= $option['label'] ?></option>
<?php endforeach; ?>
</select>
<?php else: ?>
<?php
$defaultVal = ($field['default'] ?? '') === 'now' ? date('Y-m-d\\TH:i') : ($field['default'] ?? '');
$valToUse = $currentValue ?? $defaultVal;
?>
<input type="<?= $field['type'] ?>" id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-control" value="<?= htmlspecialchars((string)$valToUse) ?>">
<?php endif; ?>
</div>
<?php endif; ?>
<?php endforeach; ?>"
if old_block in content:
content = content.replace(old_block, new_block)
with open('_get_instance_details.php', 'w') as f:
f.write(content)
print("Patched successfully")
else:
print("Old block not found!")

55
patch_modal3.php Normal file
View File

@ -0,0 +1,55 @@
<?php
$file = '_get_instance_details.php';
$content = file_get_contents($file);
$start = "<?php foreach ($currentNode['ui_hints']['form_schema'] as $field): ";
$end = "<?php endforeach; ";
$pos_start = strpos($content, $start);
$pos_end = strpos($content, $end, $pos_start);
if ($pos_start !== false && $pos_end !== false) {
$full_end = $pos_end + strlen($end);
$new_block = '<?php foreach ($currentNode[\'ui_hints\'][\'form_schema\'] as $field):
$fieldName = $field[\'name\'];
$currentValue = $instanceData[$fieldName] ?? null;
?>
<?php if ($field[\'type\'] === \'checkbox\'): ?>
<div class="form-check mb-3">
<input type="hidden" name=\"<?= $fieldName ?>\" value="0">
<input type="checkbox" id=\"<?= $fieldName ?>\" name=\"<?= $fieldName ?>\" class="form-check-input" value="1" <?= (!empty($currentValue) || (!isset($currentValue) && !empty($field[\'default\']))) ? \'checked\' : \'\' ?>/>
<label for=\"<?= $fieldName ?>\" class="form-check-label"><?= $field[\'label\'] ?></label>
</div>
<?php else: ?>
<div class="mb-3">
<label for=\"<?= $fieldName ?>\" class="form-label"><?= $field[\'label\'] ?></label>
<?php if ($field[\'type\'] === \'textarea\'): ?>
<textarea id=\"<?= $fieldName ?>\" name=\"<?= $fieldName ?>\" class="form-control"><?= htmlspecialchars((string)($currentValue ?? \'\')) ?></textarea>
<?php elseif ($field[\'type\'] === \'select\'): ?>
<select id=\"<?= $fieldName ?>\" name=\"<?= $fieldName ?>\" class="form-select">
<?php foreach ($field[\'options\'] as $option):
$selected = ($currentValue !== null && (string)$currentValue === (string)$option[\'value\']) ? \'selected\' : \'\';
?>
<option value=\"<?= $option[\'value\'] ?>\" <?= $selected ?>><?= $option[\'label\'] ?></option>
<?php endforeach; ?>
</select>
<?php else: ?>
<?php
$defaultVal = ($field[\'default\'] ?? \'\') === \'now\' ? date(\'Y-m-d\\TH:i\') : ($field[\'default\'] ?? \'\');
$valToUse = $currentValue ?? $defaultVal;
?>
<input type=\"<?= $field[\'type\'] ?>\" id=\"<?= $fieldName ?>\" name=\"<?= $fieldName ?>\" class="form-control" value=\"<?= htmlspecialchars((string)$valToUse) ?>\">
<?php endif; ?>
</div>
<?php endif; ?>
<?php endforeach; ?>';
$content = substr_replace($content, $new_block, $pos_start, $full_end - $pos_start);
file_put_contents($file, $content);
echo "Patched successfully\n";
} else {
echo "Not found!\n";
}
?>

48
patch_regex.py Normal file
View File

@ -0,0 +1,48 @@
import re
with open('_get_instance_details.php', 'r') as f:
content = f.read()
pattern = re.compile(r"<\?php foreach \(\$currentNode\['ui_hints'\]\['form_schema'\] as \$field\): \?>(.*?)<\?php endforeach; \?>", re.DOTALL)
replacement = r"""<?php foreach ($currentNode['ui_hints']['form_schema'] as $field):
$fieldName = $field['name'];
$currentValue = $instanceData[$fieldName] ?? null;
?>
<?php if ($field['type'] === 'checkbox'): ?>
<div class="form-check mb-3">
<input type="hidden" name="<?= $fieldName ?>" value="0">
<input type="checkbox" id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-check-input" value="1" <?= (!empty($currentValue) || (!isset($currentValue) && !empty($field['default']))) ? 'checked' : '' ?>>
<label for="<?= $fieldName ?>" class="form-check-label"><?= $field['label'] ?></label>
</div>
<?php else: ?>
<div class="mb-3">
<label for="<?= $fieldName ?>" class="form-label"><?= $field['label'] ?></label>
<?php if ($field['type'] === 'textarea'): ?>
<textarea id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-control"><?= htmlspecialchars((string)($currentValue ?? '')) ?></textarea>
<?php elseif ($field['type'] === 'select'): ?>
<select id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-select">
<?php foreach ($field['options'] as $option):
$selected = ($currentValue !== null && (string)$currentValue === (string)$option['value']) ? 'selected' : '';
?>
<option value="<?= $option['value'] ?>" <?= $selected ?>><?= $option['label'] ?></option>
<?php endforeach; ?>
</select>
<?php else: ?>
<?php
$defaultVal = ($field['default'] ?? '') === 'now' ? date('Y-m-d\TH:i') : ($field['default'] ?? '');
$valToUse = $currentValue ?? $defaultVal;
?>
<input type="<?= $field['type'] ?>" id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-control" value="<?= htmlspecialchars((string)$valToUse) ?>">
<?php endif; ?>
</div>
<?php endif; ?>
<?php endforeach; ?>"""
if pattern.search(content):
content = pattern.sub(replacement, content, count=1)
with open('_get_instance_details.php', 'w') as f:
f.write(content)
print("Patched successfully!")
else:
print("Pattern not found!")

48
patch_regex2.py Normal file
View File

@ -0,0 +1,48 @@
import re
with open('_get_instance_details.php', 'r') as f:
content = f.read()
pattern = re.compile(r"<\?php foreach \(\$currentNode\[\'ui_hints\'\]\[\'form_schema\'\] as \$field\): \?>(.*?)<\?php endforeach; \?>", re.DOTALL)
replacement = r"""<\?php foreach ($currentNode['ui_hints']['form_schema'] as $field):
$fieldName = $field['name'];
$currentValue = $instanceData[$fieldName] ?? null;
?>
<?php if ($field['type'] === 'checkbox'): ?>
<div class="form-check mb-3">
<input type="hidden" name="<?= $fieldName ?>" value="0">
<input type="checkbox" id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-check-input" value="1" <?= (!empty($currentValue) || (!isset($currentValue) && !empty($field['default']))) ? 'checked' : '' ?>>
<label for="<?= $fieldName ?>" class="form-check-label"><?= $field['label'] ?></label>
</div>
<?php else: ?>
<div class="mb-3">
<label for="<?= $fieldName ?>" class="form-label"><?= $field['label'] ?></label>
<?php if ($field['type'] === 'textarea'): ?>
<textarea id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-control"><?= htmlspecialchars((string)($currentValue ?? '')) ?></textarea>
<?php elseif ($field['type'] === 'select'): ?>
<select id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-select">
<?php foreach ($field['options'] as $option):
$selected = ($currentValue !== null && (string)$currentValue === (string)$option['value']) ? 'selected' : '';
?>
<option value="<?= $option['value'] ?>" <?= $selected ?>><?= $option['label'] ?></option>
<?php endforeach; ?>
</select>
<?php else: ?>
<?php
$defaultVal = ($field['default'] ?? '') === 'now' ? date('Y-m-d\\TH:i') : ($field['default'] ?? '');
$valToUse = $currentValue ?? $defaultVal;
?>
<input type="<?= $field['type'] ?>" id="<?= $fieldName ?>" name="<?= $fieldName ?>" class="form-control" value="<?= htmlspecialchars((string)$valToUse) ?>">
<?php endif; ?>
</div>
<?php endif; ?>
<?php endforeach; ?>"
if pattern.search(content):
content = pattern.sub(lambda m: replacement, content, count=1)
with open('_get_instance_details.php', 'w') as f:
f.write(content)
print("Patched successfully!")
else:
print("Pattern not found!")

87
run_base64.py Normal file
View File

@ -0,0 +1,87 @@
import base64
import os
script_b64 = b"""
aW1wb3J0IHJlCgp3aXRoIG9wZW4oJ19nZXRfaW5zdGFuY2VfZGV0YWlscy5waHAnLCAncicpIGFz
IGY6CiAgICBjb250ZW50ID0gZi5yZWFkKCkKCm9sZF9ibG9jayA9ICIiIiAgICAgICAgICAgICAg
ICAgICAgICAgIDw/cGhwIGZvcmVhY2ggKCRjdXJyZW50Tm9kZVsndWlfaGludHMnXVsnZm9ybV9z
Y2hlbWEnXSBhcyAkZmllbGQpOiA/PgogICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNz
PSJtYi0zIj4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxsYWJlbCBmb3I9Ijw/PSAkZmll
bGRbJ25hbWUnXSA/PiIgY2xhc3M9ImZvcm0tbGFiZWwiPjw/PSAkZmllbGRbJ2xhYmVsJ10gPz48
L2xhYmVsPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgPD9waHAgaWYgKCRmaWVsZFsndHlw
ZSddID09PSAndGV4dGFyZWEnKTogPz4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8
dGV4dGFyZWEgaWQ9Ijw/PSAkZmllbGRbJ25hbWUnXSA/PiIgbmFtZT0iPD89ICRmaWVsZFsnbmFt
ZSddID8+IiBjbGFzcz0iZm9ybS1jb250cm9sIj48L3RleHRhcmVhPgogICAgICAgICAgICAgICAg
ICAgICAgICAgICAgPD9waHAgZWxzZWlmICgkZmllbGRbJ3R5cGUnXSA9PT0gJ3NlbGVjdCcpOiA/
PgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxzZWxlY3QgaWQ9Ijw/PSAkZmllbGRb
J25hbWUnXSA/PiIgbmFtZT0iPD89ICRmaWVsZFsnbmFtZSddID8+IiBjbGFzcz0iZm9ybS1zZWxl
Y3QiPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8P3BocCBmb3JlYWNoICgk
ZmllbGRbJ29wdGlvbnMnXSBhcyAkb3B0aW9uKTogPz4KICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgIDxvcHRpb24gdmFsdWU9Ijw/PSAkb3B0aW9uWyd2YWx1ZSddID8+Ij48
Pz0gJG9wdGlvblsnbGFiZWwnXSA/Pjwvb3B0aW9uPgogICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICA8P3BocCBlbmRmb3JlYWNoOyA/PgogICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgIDwvc2VsZWN0PgogICAgICAgICAgICAgICAgICAgICAgICAgICAgPD9waHAgZWxzZTog
Pz4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8aW5wdXQgdHlwZT0iPD89ICRmaWVs
ZFsndHlwZSddID8+IiBpZD0iPD89ICRmaWVsZFsnbmFtZSddID8+IiBuYW1lPSI8Pz0gJGZpZWxk
WyduYW1lJ10gPz4iIGNsYXNzPSJmb3JtLWNvbnRyb2wiIHZhbHVlPSI8Pz0gKCRmaWVsZFsnZGVm
YXVsdCddID8/ICcnKSA9PT0gJ25vdycgPyBkYXRlKCdZLW0tZFxcVEg6aScpIDogJycgPz4iPgog
ICAgICAgICAgICAgICAgICAgICAgICAgICAgPD9waHAgZW5kaWY7ID8+CiAgICAgICAgICAgICAg
ICAgICAgICAgIDwvZGl2PgogICAgICAgICAgICAgICAgICAgICAgICA8P3BocCBlbmRmb3JlYWNo
OyA/PiIiIgoKbmV3X2Jsb2NrID0gIiIiICAgICAgICAgICAgICAgICAgICAgICAgPD9waHAgZm9y
ZWFjaCAoJGN1cnJlbnROb2RlWyd1aV9oaW50cyddWydmb3JtX3NjaGVtYSddIGFzICRmaWVsZCk6
IAogICAgICAgICAgICAgICAgICAgICAgICAgICAgJGZpZWxkTmFtZSA9ICRmaWVsZFsnbmFtZSdd
OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgJGN1cnJlbnRWYWx1ZSA9ICRpbnN0YW5jZURh
dGFbJGZpZWxkTmFtZV0gPz8gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgICAgPz4KICAgICAg
ICAgICAgICAgICAgICAgICAgICAgIDw/cGhwIGlmICgkZmllbGRbJ3R5cGUnXSA9PT0gJ2NoZWNr
Ym94Jyk6ID8+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz0iZm9y
bS1jaGVjayBtYi0zIj4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGlucHV0
IHR5cGU9ImhpZGRlbiIgbmFtZT0iPD89ICRmaWVsZE5hbWUgPz4iIHZhbHVlPSIwIj4KICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGlucHV0IHR5cGU9ImNoZWNrYm94IiBpZD0i
PD89ICRmaWVsZE5hbWUgPz4iIG5hbWU9Ijw/PSAkZmllbGROYW1lID8+IiBjbGFzcz0iZm9ybS1j
aGVjay1pbnB1dCIgdmFsdWU9IjEiIDw/PSAoIWVtcHR5KCRjdXJyZW50VmFsdWUpIHx8ICghaXNz
ZXQoJGN1cnJlbnRWYWx1ZSkgJiYgIWVtcHR5KCRmaWVsZFsnZGVmYXVsdCddKSkpID8gJ2NoZWNr
ZWQnIDogJycgPz4+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxsYWJlbCBm
b3I9Ijw/PSAkZmllbGROYW1lID8+IiBjbGFzcz0iZm9ybS1jaGVjay1sYWJlbCI+PD89ICRmaWVs
ZFsnbGFiZWwnXSA/PjwvbGFiZWw+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9k
aXY+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8P3BocCBlbHNlOiA/PgogICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9Im1iLTMiPgogICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICA8bGFiZWwgZm9yPSI8Pz0gJGZpZWxkTmFtZSA/PiIgY2xhc3M9
ImZvcm0tbGFiZWwiPjw/PSAkZmllbGRbJ2xhYmVsJ10gPz48L2xhYmVsPgogICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICA8P3BocCBpZiAoJGZpZWxkWyd0eXBlJ10gPT09ICd0ZXh0
YXJlYScpOiA/PgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPHRleHRh
cmVhIGlkPSI8Pz0gJGZpZWxkTmFtZSA/PiIgbmFtZT0iPD89ICRmaWVsZE5hbWUgPz4iIGNsYXNz
PSJmb3JtLWNvbnRyb2wiPjw/PSBodG1sc3BlY2lhbGNoYXJzKChzdHJpbmcpKCRjdXJyZW50VmFs
dWUgPz8gJycpKSA/PjwvdGV4dGFyZWE+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgIDw/cGhwIGVsc2VpZiAoJGZpZWxkWyd0eXBlJ10gPT09ICdzZWxlY3QnKTogPz4KICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxzZWxlY3QgaWQ9Ijw/PSAkZmllbGRO
YW1lID8+IiBuYW1lPSI8Pz0gJGZpZWxkTmFtZSA/PiIgY2xhc3M9ImZvcm0tc2VsZWN0Ij4KICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8P3BocCBmb3JlYWNoICgk
ZmllbGRbJ29wdGlvbnMnXSBhcyAkb3B0aW9uKTogCiAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICRzZWxlY3RlZCA9ICgkY3VycmVudFZhbHVlICE9PSBudWxs
ICYmIChzdHJpbmcpJGN1cnJlbnRWYWx1ZSA9PT0gKHN0cmluZykkb3B0aW9uWyd2YWx1ZSddKSA/
ICdzZWxlY3RlZCcgOiAnJzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICA/PgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8
b3B0aW9uIHZhbHVlPSI8Pz0gJG9wdGlvblsndmFsdWUnXSA/PiIgPD89ICRzZWxlY3RlZCA/Pj48
Pz0gJG9wdGlvblsnbGFiZWwnXSA/Pjwvb3B0aW9uPgogICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgIDw/cGhwIGVuZGZvcmVhY2g7ID8+CiAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICA8L3NlbGVjdD4KICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgPD9waHAgZWxzZTogPz4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgIDw/cGhwIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICRkZWZhdWx0VmFsID0gKCRmaWVsZFsnZGVmYXVsdCddID8/ICcnKSA9PT0gJ25vdycgPyBk
YXRlKCdZLW0tZFxcVEg6aScpIDogKCRmaWVsZFsnZGVmYXVsdCddID8/ICcnKTsKICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdmFsVG9Vc2UgPSAkY3VycmVudFZh
bHVlID8/ICRkZWZhdWx0VmFsOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgPz4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxpbnB1dCB0eXBl
PSI8Pz0gJGZpZWxkWyd0eXBlJ10gPz4iIGlkPSI8Pz0gJGZpZWxkTmFtZSA/PiIgbmFtZT0iPD89
ICRmaWVsZE5hbWUgPz4iIGNsYXNzPSJmb3JtLWNvbnRyb2wiIHZhbHVlPSI8Pz0gaHRtbHNwZWNp
YWxjaGFycygoc3RyaW5nKSR2YWxUb1VzZSkgPz4iPgogICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICA8P3BocCBlbmRpZjsgPz4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICA8L2Rpdj4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw/cGhwIGVuZGlmOyA/PgogICAg
ICAgICAgICAgICAgICAgICAgICA8P3BocCBlbmRmb3JlYWNoOyA/PiIiIgoKaWYgb2xkX2Jsb2Nr
IGluIGNvbnRlbnQ6CiAgICBjb250ZW50ID0gY29udGVudC5yZXBsYWNlKG9sZF9ibG9jaywgbmV3
X2Jsb2NrKQogICAgd2l0aCBvcGVuKCdfZ2V0X2luc3RhbmNlX2RldGFpbHMucGhwJywgJ3cnKSBh
cyBmOgogICAgICAgIGYud3JpdGUoY29udGVudCkKICAgIHByaW50KCJQYXRjaGVkIHN1Y2Nlc3Nm
dWxseSIpCmVsc2U6CiAgICBwcmludCgiT2xkIGJsb2NrIG5vdCBmb3VuZCEiKQ=="""
with open("do_patch.py", "w") as f:
f.write(base64.b64decode(script_b64).decode('utf-8'))

68
run_base64_patch.py Normal file
View File

@ -0,0 +1,68 @@
import base64
import os
script_b64 = b"""
aW1wb3J0IHJlCgp3aXRoIG9wZW4oJ19nZXRfaW5zdGFuY2VfZGV0YWlscy5waHAnLCAncicpIGFz
IGY6CiAgICBjb250ZW50ID0gZi5yZWFkKCkKCnBhdHRlcm4gPSByZS5jb21waWxlKHIiPFw/cGhw
IGZvcmVhY2ggXChcZGN1cnJlbnROb2RlXFsndWlfaGludHMnXF1cWydmb3JtX3NjaGVtYSdcXSBh
cyBcJGZpZWxkXCk6IFw/PiguKj8pPFw/cGhwIGVuZGZvcmVhY2g7IFw/PiIsIHJlLkRPVEFMTCkK
CiMgdXNlIGEgZnVuY3Rpb24gZm9yIHJlcGxhY2VtZW50IHNvIGl0IGRvZXNudCBwYXJzZSBiYWNr
c2xhc2hlcwpyZXBsYWNlbWVudF90ZXh0ID0gciIiIjw/cGhwIGZvcmVhY2ggKCRjdXJyZW50Tm9k
ZVsndWlfaGludHMnXVsnZm9ybV9zY2hlbWEnXSBhcyAkZmllbGQpOiAKICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICRmaWVsZE5hbWUgPSAkZmllbGRbJ25hbWUnXTsKICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICRjdXJyZW50VmFsdWUgPSAkaW5zdGFuY2VEYXRhWyRmaWVsZE5hbWVdID8/
IG51bGw7CiAgICAgICAgICAgICAgICAgICAgICAgID8+CiAgICAgICAgICAgICAgICAgICAgICAg
ICAgICA8P3BocCBpZiAoJGZpZWxkWyd0eXBlJ10gPT09ICdjaGVja2JveCcpOiA/PgogICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9ImZvcm0tY2hlY2sgbWItMyI+CiAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxpbnB1dCB0eXBlPSJoaWRkZW4iIG5h
bWU9Ijw/PSAkZmllbGROYW1lID8+IiB2YWx1ZT0iMCI+CiAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgIDxpbnB1dCB0eXBlPSJjaGVja2JveCIgaWQ9Ijw/PSAkZmllbGROYW1lID8+
IiBuYW1lPSI8Pz0gJGZpZWxkTmFtZSA/PiIgY2xhc3M9ImZvcm0tY2hlY2staW5wdXQiIHZhbHVl
PSIxIiA8Pz0gKCFlbXB0eSgkY3VycmVudFZhbHVlKSB8fCAoIWlzc2V0KCRjdXJyZW50VmFsdWUp
ICYmICFlbXB0eSgkZmllbGRbJ2RlZmF1bHQnXSkpKSA/ICdjaGVja2VkJyA6ICcnID8+PgogICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8bGFiZWwgZm9yPSI8Pz0gJGZpZWxkTmFt
ZSA/PiIgY2xhc3M9ImZvcm0tY2hlY2stbGFiZWwiPjw/PSAkZmllbGRbJ2xhYmVsJ10gPz48L2xh
YmVsPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PgogICAgICAgICAgICAg
ICAgICAgICAgICAgICAgPD9waHAgZWxzZTogPz4KICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICA8ZGl2IGNsYXNzPSJtYi0zIj4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgPGxhYmVsIGZvcj0iPD89ICRmaWVsZE5hbWUgPz4iIGNsYXNzPSJmb3JtLWxhYmVsIj48Pz0g
JGZpZWxkWydsYWJlbCddID8+PC9sYWJlbD4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgPD9waHAgaWYgKCRmaWVsZFsndHlwZSddID09PSAndGV4dGFyZWEnKTogPz4KICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDx0ZXh0YXJlYSBpZD0iPD89ICRmaWVs
ZE5hbWUgPz4iIG5hbWU9Ijw/PSAkZmllbGROYW1lID8+IiBjbGFzcz0iZm9ybS1jb250cm9sIj48
Pz0gaHRtbHNwZWNpYWxjaGFycygoc3RyaW5nKSgkY3VycmVudFZhbHVlID8/ICcnKSkgPz48L3Rl
eHRhcmVhPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8P3BocCBlbHNlaWYg
KCRmaWVsZFsndHlwZSddID09PSAnc2VsZWN0Jyk6ID8+CiAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICA8c2VsZWN0IGlkPSI8Pz0gJGZpZWxkTmFtZSA/PiIgbmFtZT0iPD89
ICRmaWVsZE5hbWUgPz4iIGNsYXNzPSJmb3JtLXNlbGVjdCI+CiAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgPD9waHAgZm9yZWFjaCAoJGZpZWxkWydvcHRpb25zJ10g
YXMgJG9wdGlvbik6IAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAkc2VsZWN0ZWQgPSAoJGN1cnJlbnRWYWx1ZSAhPT0gbnVsbCAmJiAoc3RyaW5nKSRjdXJy
ZW50VmFsdWUgPT09IChzdHJpbmcpJG9wdGlvblsndmFsdWUnXSkgPyAnc2VsZWN0ZWQnIDogJyc7
CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPz4KICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8b3B0aW9uIHZhbHVlPSI8Pz0gJG9w
dGlvblsndmFsdWUnXSA/PiIgPD89ICRzZWxlY3RlZCA/Pj48Pz0gJG9wdGlvblsnbGFiZWwnXSA/
Pjwvb3B0aW9uPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPD9waHAg
ZW5kZm9yZWFjaDsgPz4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwv
c2VsZWN0PgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8P3BocCBlbHNlOiA/
PgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPD9waGAgCiAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJGRlZmF1bHRWYWwgPSAoJGZpZWxk
WydkZWZhdWx0J10gPz8gJycpID09PSAnbm93JyA/IGRhdGUoJ1ktbS1kXFxUSDppJykgOiAoJGZp
ZWxkWydkZWZhdWx0J10gPz8gJycpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICR2YWxUb1VzZSA9ICRjdXJyZW50VmFsdWUgPz8gJGRlZmF1bHRWYWw7CiAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA/PgogICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgPGlucHV0IHR5cGU9Ijw/PSAkZmllbGRbJ3R5cGUnXSA/PiIg
aWQ9Ijw/PSAkZmllbGROYW1lID8+IiBuYW1lPSI8Pz0gJGZpZWxkTmFtZSA/PiIgY2xhc3M9ImZv
cm0tY29udHJvbCIgdmFsdWU9Ijw/PSBodG1sc3BlY2lhbGNoYXJzKChzdHJpbmcpJHZhbFRvVXNl
KSA/PiI+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw/cGhwIGVuZGlmOyA/
PgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PgogICAgICAgICAgICAgICAg
ICAgICAgICAgICAgPD9waHAgZW5kaWY7ID8+CiAgICAgICAgICAgICAgICAgICAgICAgIDw/cGhw
IGVuZGZvcmVhY2g7ID8+IiIiCgpkZWYgcmVwbGFjZXIobWF0Y2gpOgogICAgcmV0dXJuIHJlcGxh
Y2VtZW50X3RleHQKCm1hdGNoZXMgPSBwYXR0ZXJuLnNlYXJjaChjb250ZW50KQppZiBtYXRjaGVz
OgogICAgY29udGVudCA9IHBhdHRlcm4uc3ViKHJlcGxhY2VyLCBjb250ZW50LCBjb3VudD0xKQog
ICAgd2l0aCBvcGVuKCdfZ2V0X2luc3RhbmNlX2RldGFpbHMucGhwJywgJ3cnKSBhcyBmOgogICAg
ICAgIGYud3JpdGUoY29udGVudCkKICAgIHByaW50KCJQYXRjaGVkIHN1Y2Nlc3NmdWxseSEiKQpl
bHNlOgogICAgcHJpbnQoIlBhdHRlcm4gbm90IGZvdW5kISIpCg=="""
with open("do_patch_base64.py", "w") as f:
f.write(base64.b64decode(script_b64).decode('utf-8'))