How can you higher your Ping with the help of Python - python

My friend asked me as a Joke if I can make a "programm" that will higher your ping.
So that you will have a little delay.
The Problem is that i want to this in python cause i want to learn it.
And I have less to no experience in python.
Everybody that had a clue how python works wanted me to reset the whole program to do that (like System.Threading.Thread.Sleep(1000)). But when I told them that I want to reset or delay the Internet on my computer so if I send a package to the server the answer needs +5sec to get back they had no Idea.
I have no code that could help you help me cause I only have the GUI and some irrelevant and independet other features ready.
So if anyone can show me how this in python could work or give me at least an idea how I could try it, it would be awesome.
Thanks for reading and maybe even helping :D
Leo

Related

Generate a certificate for .exe created by pyinstaller

I wrote a script for my company that randomly selects employees for random drug tests. It works wonderfully, except when I gave it to the person who would use the program. She clicked on it and a message popped up asking if she trusts the program. AFter clicking run anyways, AVG flagged it two more times before it would finally load. I read someone else's comment saying to make an exception for it on the antivirus. The problem is, I wrote another program that reads other scripts and reads/writes txt files, generates excel spreadsheets and many other things. I'm really close to releasing the final product to a few select companies as a trial, and this certificate thing is going to be an issue. I code for fun, so there's a lot of lingo that goes right by me. Can someone point me in the right direction where I can get some information on creating a trusted program?
It appears to be a whole long process to obtain a digital certification. You need one to be issued by a certification authority. Microsoft appears to have a docs page on it.
After you have the certification, you'd need to sign your .exe file after it's been created using a tool like SignTool. You may find more useful and detailed answers than I can provide you in this thread, as I actually only know quite little about this whole process and can only redirect you to those who know more. I'd suggest you look through what I have listed here before asking me any more, since I probably know about as much as you do past this point.
If anyone else is having this problem, I stumbled on a solution that works for me.
I created an Install Wizard using Inno Setup. Before I could install the software (My drug test program), it got flagged, asking me if I trust the software. I clicked "run anyway" and my antivirus flagged it two more times. After the program was installed. it never flagged me again. Since my main program will probably be used by 100-200 people, I'm completely fine having to do that procedure once. However, for a more "professional" result, it's probably work investing in certificates.

Automating DOSbox application

I have a very old DOS application which I would like to automate. Like there are keypresses and such which if automated will help a lot as I might have to run the program over a hundred times manually.
My question seems to be very similar to this one but the solutions offered there are not very useful for me, plus it is over nine years old
Automating old DOS application using Python
Only big difference between this question and mine is that I have no option other than DOSbox for doing this. This application is set up on a lot of computers, and all the people using the application know how to use DOSBox. Migrating to Virtualbox would be a pain and very time-consuming.
I was thinking maybe if I could mechanize this somehow in python using xautomaton or uinput, but I haven't been able to figure out exactly how. The application will be running on Ubuntu primarily.
To give an idea of the application, I am attaching a screenshot:
The solution does not necessarily need to be in python. Any other language would work. Any help is appreciated.
I figured this out. Although this does not use python, to do this, I just captured the windowid of DOSbox and sent all the key presses there using xdotool. Here is an example:
wid=$(xdotool search --class DOSbox)
xdotool key --window $wid m t 5 Return Return i
Which will type "mt5", then press enter twice and then type "i"
The series of keypresses can be stored in a string or a file and called iteratively each time this has to be run. If there is a better method to do this, please feel free to answer.

Rasa chatbot won't answer to some messages

I am building a chatbot using rasa_core and rasa_nlu. As of now I am simply deploying it on my Ubuntu shell (I am using Windows 10). Now my problem is that from time to time, the bot won't answer to my messages: it directly goes to the 'Action_listen' action. After this, the only way to have the bot work normally again is to exit and relaunch it.
Strangely, I cannot derive any pattern to explain what causes this problem, and the very same conversation history can both cause this problem or no problem at all. That makes debugging specifically difficult as I cannot reproduce this problem on demand.
Nothing appears. I have changed rasa's code so that it prints the outputs of the intent recognition and of _get_next_action in processor.py. The output of the intent recognition does appear normally, the ouput of _get_next_action is:
Action('action_listen')
Any idea what might be the cause and the solution ?
Thank you for your help,
Best,
Vincent.
This happened to me in the initial stages.
My issue was that my intents were quite confusing for the bot. For example, two contradicting statements had the same intent or I had too many things under the same intent. I fixed this by changing my intents and entities.
If you post your stories, someone can help. It is really tough to know more without information.

How to encrypt files in twisted?

I'm using twisted to create a server.
Problem is, I must protect my code. Since I don't want to publish it, I'm not really interess into obfuscation or compilation of the python code.
My problem is, my twisted application must run with root uid and a lot of people have root access to this server.
I don't care if they can read it, but I want sure they can't modify it!
What is the best solution, knowing I'm using twisted? I've seen in twistd, tapconvert and mktap that twisted can "encrypt" my code, but I didn't find any good documentation about that.
Anybody to help me?
Thanks in advance for any answer =)
Have a nice day!
/!\ EDIT:
I got another question, I've wrote my code following this part of twisted documentation: http://twistedmatrix.com/documents/current/core/howto/application.html so I launch my server using a command like twistd -y server.py --logfile ...
Since I'm doing that, I assume I can't use software like cx_Freeze to hide my code right ?
You have a number of problems here.
my twisted application must run with root uid
This is bad. If there are vulnerabilities in your application, then they will be made more serious by running as root. You should consider finding a way to not run as root. For example, if you only run as root so you can bind to a low numbered port, consider using authbind instead.
a lot of people have root access to this server
Perhaps you should limit privileged access to those people who actually need it. If that isn't an option, then perhaps you should at least limit access to people you can trust. Someone who has root on a machine can do anything they want on that machine, and defeat any scheme you dream up.
I don't care if they can read it, but I want sure they can't modify it!
You should ask them not to modify it, then.
I've seen in twistd, tapconvert and mktap that twisted can "encrypt" my code, but I didn't find any good documentation about that. Anybody to help me?
You shouldn't bother trying to use the encryption features of twistd and mktap. These don't prevent anyone from changing your code. At best they might prevent someone from reading some of it. As you said, this isn't even your goal. Even if it were your goal, someone with root access will be able to decrypt these files easily, so it doesn't even help there.
If you give code to someone, expect them to be able to do anything and everything they want with it. If you put code on a server, you are effectively giving it to everyone with root access to that server.
So, stop thinking about encryption and other technical issues and think of some other way to achieve your goals - fire the untrustworthy administrators, use an appropriate license on the code, get an actual contract, etc.
AFAIK, there is no way to prevent a root user from modifying a plain text file. Root is just that, they can do anything they want with it including modifying. Why do so many people have root access to the machine anyway?
If you're concerned, you really have two options:
Encrypt the files in whatever way you want (I don't know if Twisted does it or how)
'Compile' the code for your platform. There are a few Python compilers out there but I don't know if they work with Linux. I'm a free software guy so I want people to read and modify my code. Protecting it doesn't concern me.
I guess you do have a third option of protecting it legally with a license. But if they violate your license then there's the cost of taking them to court over it.
Not many options. Sorry.
Anthony

python reporting tool, similar to birtviewer

Can you guys please tell if building my own birtviewer like reporting tool but using python is a crazy idea. The company I'm working now, we are using birtviewer to generate reports for the clients, but I'm already getting frustrated tweaking the code to suit our client needs and it's written on massive java code which I don't have any experience at all. And they don't want to mavenize birtviewer, so every new releases I have to manually update my local copy and mavenize it. And the fact that it is really owned by a private company worries me about the future of birtviewer. What do you guys think?
Sure. Write it. Make it open source and give us a git repo to have a little look... Honestly if the problem exists solve it.

Categories

Resources