Skip to content

Commit

Permalink
fixes and other stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyGamer13 committed Mar 12, 2023
1 parent b5c1370 commit 7fab107
Show file tree
Hide file tree
Showing 11 changed files with 192 additions and 90 deletions.
Binary file added RushAttack.webp
Binary file not shown.
Binary file added RushNormal.webp
Binary file not shown.
66 changes: 9 additions & 57 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const { app, BrowserWindow, dialog, ipcMain, Tray } = require('electron')
const electron = require('electron')
const path = require('path')

const psnode = require('ps-node')
const findProcess = require('find-process')

const IsDeveloperMode = false

function createWindow() {
const win = new BrowserWindow({
Expand All @@ -17,7 +17,7 @@ function createWindow() {
alwaysOnTop: true,
transparent: true,
webPreferences: {
devTools: false,
devTools: IsDeveloperMode,
sandbox: false,
spellcheck: false,
preload: path.join(__dirname, 'preload.js')
Expand All @@ -26,7 +26,7 @@ function createWindow() {

win.loadFile('index.html')
win.maximize()
win.removeMenu()
if (!IsDeveloperMode) win.removeMenu()
return win
}

Expand Down Expand Up @@ -64,60 +64,12 @@ ipcMain.handle("started", (_, __) => {
ipcMain.handle("getMousePos", (_, __) => {
return electron.screen.getCursorScreenPoint()
})

const killablePrograms = []
let programsAttempted = false

function ResetKillablePrograms() {
ipcMain.handle("killProgram", (_, pid) => {
return new Promise((resolve, reject) => {
psnode.lookup('', (err, programs) => {
if (err) return reject(err)
killablePrograms.splice(0, killablePrograms.length)
for (let i = 0; i < programs.length; i++) {
const program = programs[i]
if (String(program.command).toLowerCase().endsWith("electron.exe")) continue // dont kill yourself please
if (String(program.command).toLowerCase().endsWith("a90.exe")) continue // dont kill yourself please
if (String(program.command).toLowerCase().endsWith("node.exe")) continue // dont kill yourself please

if (String(program.command).toLowerCase().includes("system32")) continue // we are evil, not evil enough to kill a system32 process lol!
if (String(program.command).toLowerCase().includes("windowsapps")) continue // idk what this is
if (String(program.command).toLowerCase().includes("systemapps")) continue // idk what this is
if (String(program.command).toLowerCase().includes("microsoft")) continue // idk what this is
if (String(program.command).toLowerCase().includes("java\\java")) continue // idk what this is
if (String(program.command).toLowerCase().includes("steamwebhelper")) continue // idk what this is
if (String(program.command).toLowerCase().substring(0, 12).includes("windows")) continue // idk what this is
if (String(program.command).substring(1, 3) != ":\\") continue // be safe
killablePrograms.push(program)
}
resolve(killablePrograms)
psnode.kill(pid, {
timeout: 1,
}, err => {
resolve(err)
})
})
}

app.on("ready", () => {
ResetKillablePrograms().then(() => {
programsAttempted = true
}).catch(() => {
programsAttempted = true
dialog.showMessageBox({ message: "A-90 can't grab your open windows! You are safe for now." })
})
})
ipcMain.handle("killRandomProgram", (_, __) => {
const index = Math.round(Math.random() * (killablePrograms.length - 1))
const program = killablePrograms[index]
if (!program) return console.log("damn, nothing to kill")
console.log('DIE', program.command, "!")
psnode.kill(program.pid, (err) => {
if (err) {
if (!(String(err).includes("Kill process timeout"))) killablePrograms.splice(index, 1)
return
}
killablePrograms.splice(index, 1)
})
})
ipcMain.handle("programsAttempted", (_, __) => {
return programsAttempted
})
ipcMain.handle("resetKillablePrograms", (_, __) => {
ResetKillablePrograms()
})
Empty file added killprogram.js
Empty file.
27 changes: 23 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"dependencies": {
"electron-squirrel-startup": "^1.0.0",
"find-process": "^1.4.7",
"ps-node": "^0.1.6"
"ps-node": "^0.1.6",
"uiohook-napi": "^1.5.0"
},
"devDependencies": {
"@electron-forge/cli": "^6.0.5",
Expand All @@ -24,4 +25,4 @@
"@electron-forge/maker-zip": "^6.0.5",
"electron": "22.0.0"
}
}
}
Loading

0 comments on commit 7fab107

Please sign in to comment.