Last active
March 17, 2021 13:17
-
-
Save gregelin/5201bd57aa669cb2263464e2037f071b to your computer and use it in GitHub Desktop.
WSOA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style> | |
body { padding-top:24px; font-size:24pt; text-align:center; border:8px solid green; } | |
</style> | |
<script> | |
var i = 1; // set your counter to 1 | |
function myLoop() { // create a loop function | |
setTimeout(function() { // call a 3s setTimeout when the loop is called | |
window.location = "file.html"; | |
console.log('page reloaded'); // your code here | |
i++; // increment the counter | |
if (i < 100) { // if the counter < 10, call the loop function | |
myLoop(); // .. again which will trigger another | |
} // .. setTimeout() | |
}, 3000) | |
} | |
myLoop(); // start the loop | |
</script> | |
</head> | |
<body> | |
The File | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style> | |
body { padding-top:24px; font-size:24pt; text-align:center; border:8px solid red; } | |
</style> | |
<script> | |
var i = 1; // set your counter to 1 | |
function myLoop() { // create a loop function | |
setTimeout(function() { // call a 3s setTimeout when the loop is called | |
window.location = "file.html"; | |
console.log('page reloaded'); // your code here | |
i++; // increment the counter | |
if (i < 100) { // if the counter < 10, call the loop function | |
myLoop(); // .. again which will trigger another | |
} // .. setTimeout() | |
}, 3000) | |
} | |
myLoop(); // start the loop | |
</script> | |
</head> | |
<body> | |
Reset | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python script | |
import sys, json, time | |
oscal = json.load(sys.stdin) | |
content = oscal['system-security-plan']['system-implementation']['components']['8a37089d-1a4f-4aa3-9e39-aa064c71d521']['title'] | |
# Conditionally set border_color | |
if 1 == 1: | |
border_color = 'green' | |
else: | |
border_color = 'red' | |
html = f"""<html> | |
<head> | |
<style> | |
body {{ padding-top:24px; font-size:24pt; text-align:center; border:8px solid {border_color}; }} | |
</style> | |
<script> | |
var i = 1; // set your counter to 1 | |
function myLoop() {{ // create a loop function | |
setTimeout(function() {{ // call a 3s setTimeout when the loop is called | |
window.location = "file.html"; | |
console.log('page reloaded'); // your code here | |
i++; // increment the counter | |
if (i < 100) {{ // if the counter < 10, call the loop function | |
myLoop(); // .. again which will trigger another | |
}} // .. setTimeout() | |
}}, 3000) | |
}} | |
myLoop(); // start the loop | |
</script> | |
</head> | |
<body> | |
{content} | |
</body> | |
</html>""" | |
# Save content to file | |
f = open('file.html', 'w') | |
f.write(html) | |
f.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define file path | |
$fp = "C:\Users\grege\wsoa" | |
$watcher = New-Object System.IO.FileSystemWatcher | |
$watcher.Path = $fp | |
$watcher.EnableRaisingEvents = $true | |
$action = | |
{ | |
$path = $event.SourceEventArgs.FullPath | |
$changetype = $event.SourceEventArgs.ChangeType | |
Get-Content -Raw -Path '.\ssp_v1_oscal_json (1).json' | python wsoa.py | Wait-Process; start 'file.html'Write-Host "$path was $changetype at $(get-date)" | |
} | |
Register-ObjectEvent $watcher 'Created' -Action $action | |
# older action | |
$action = | |
{ | |
$path = $event.SourceEventArgs.FullPath | |
$changetype = $event.SourceEventArgs.ChangeType | |
Write-Host "$path was $changetype at $(get-date)" | |
} | |
# oneliners | |
Get-Content -Raw -Path '.\ssp_v1_oscal_json (1).json' | python -c "import sys, json; oscal = json.load(sys.stdin); print(oscal['system-security-plan']['system-implementation']['components']['8a37089d-1a4f-4aa3-9e39-aa064c71d521']['title'])" | |
Get-Content -Raw -Path '.\ssp_v1_oscal_json (1).json' | python -c "import sys, json; oscal = json.load(sys.stdin); content = oscal['system-security-plan']['system-implementation']['components']['8a37089d-1a4f-4aa3-9e39-aa064c71d521']['title']; f = open('file.html', w); f.write(content); f.close()" | start 'file.html' | |
# oneliner using python script | |
# wsoa.py will change content of the file. | |
Get-Content -Raw -Path '.\ssp_v1_oscal_json (1).json' | python wsoa.py | Wait-Process; start 'file.html' | |
# change content of file | |
# Open file in browser | |
start 'file.html' | |
# Set WallPaper | |
Function Set-WallPaper($value) | |
{ | |
Set-ItemProperty -path 'HKCU:\Control Panel\Desktop\' -name wallpaper -value $value | |
rundll32.exe user32.dll, UpdatePerUserSystemParameters | |
} | |
Set-WallPaper -value "path to wallpaper" | |
Set-WallPaper -value "path to wallpaper" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment