Skip to content

Commit

Permalink
Flashbang com arquivo
Browse files Browse the repository at this point in the history
  • Loading branch information
GuiBrandt committed Feb 27, 2019
1 parent 5c505fe commit 3668389
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions danger.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--- #-------------------------------------------------------------------------------
#===============================================================================
# * danger.yml
#===============================================================================
Expand All @@ -9,7 +10,6 @@
#===============================================================================
#-------------------------------------------------------------------------------
# Lista de processos que serão fechados (.exe é opcional)
#-------------------------------------------------------------------------------
kill:
- mspaint
- chrome
Expand All @@ -25,4 +25,4 @@ cmd:
#-------------------------------------------------------------------------------
# Flashbang: Abre um bloco de notas maximizado, pra esconder a tela
#-------------------------------------------------------------------------------
flashbang: false
flashbang: false
4 changes: 3 additions & 1 deletion god/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ def print_settings():

for key in config.keys():
value = config.get(key)
print("\t", key, Fore.CYAN + ':' + Fore.RESET, " \t", value, sep='')
print(
"\t", (key + Fore.CYAN + ':' + Fore.RESET).ljust(40), value,
sep='')
print(flush=True)


Expand Down
9 changes: 5 additions & 4 deletions god/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
import yaml

_DEFAULTS = {
"psname": "notepad.exe",
"flashbang_file": None,
"frequency": 30,
"threshold": 1,
"frequency": 30
"psname": "notepad.exe"
}

_config = {}
Expand All @@ -23,14 +24,14 @@ def load(cfg_file="config.yml"):
return

global _config
with open(cfg_file, "r") as file:
with open(cfg_file, "r", encoding="utf8") as file:
_config = yaml.load(file) or _config


def save(cfg_file="config.yml"):
"""Salva as configurações para um arquivo"""

with open(cfg_file, 'w') as file:
with open(cfg_file, 'w', encoding="utf8") as file:
yaml.dump(_config, file, default_flow_style=False)


Expand Down
6 changes: 5 additions & 1 deletion god/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""

import os
import json

import yaml
import win32con
Expand All @@ -14,6 +15,7 @@
import win32process

import god
import god.config as config
import god.cli as cli
import god.log as log

Expand All @@ -25,12 +27,14 @@ def flashbang_notepad():
"""

file = config.get("flashbang_file")

start_info = win32process.STARTUPINFO()
start_info.dwFlags = win32con.STARTF_USESHOWWINDOW
start_info.wShowWindow = win32con.SW_MAXIMIZE
win32process.CreateProcess(
None,
"notepad",
f"notepad {file}" if file else "notepad",
None,
None,
False,
Expand Down

0 comments on commit 3668389

Please sign in to comment.