Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [python]

High-level dynamic language developed by Guido van Rossum, particularly popular for server-side web programming and scripting.

0
votes
0answers
23 views

mitmproxy on Raspberry Pi [migrated]

I'm trying to run mitmproxy on Raspberry Pi to run some tests however although Python3 is installed and python2 is uninstalled, I keep getting an error when trying to run mitmproxy - mitmproxy ...
0
votes
1answer
57 views

Trying to understand/use openssl for decryption

There are many questions around this topic, but I haven't found one that explains exactly my issue. I am encrypting data with AES 128 CBC, but using python and pycryptodome (should have used the ...
1
vote
0answers
31 views

Is it secure to start a NTLM handshake not knowing if the server supports it?

I am writing a program in Python using the requests-ntlm library. That library adds support for NTLM in regular requests: import requests from requests_ntlm import HttpNtlmAuth requests.get("http://...
-3
votes
0answers
11 views

How to access Nested Dictionary values through index [migrated]

Im building a scanner using python-nmap libary. Here's the code : import nmap import json def Nmap_Recon(host, port): nm = nmap.PortScanner() lol = nm.scan(host, '22-443') print(lol['scan'])...
1
vote
0answers
51 views

How to correctly store the users credentials [closed]

I am writing an application that requires a username/password for the first time. I was wondering if the concept code below is a valid and secure way to store user passwords in the database. I hope ...
0
votes
0answers
14 views

Convert python-pkcs11.types.PrivateKey to PrivateKeyInfo or PrivateKey

I'm building a CertificateListBuilder but it requires the python-pkcs11.types.PrivateKey to be an instance of asn1crypto.keys.PrivateKeyInfo or oscrypto.asymmetric.PrivateKey. How to do it? Is it ...
0
votes
0answers
18 views

Is it possible to export WPScan results in excel file making it as an excel report?

I am running a python script which performs a vulnerability scanning using the WPScan tool and the results are saved as a txt file localy. Using that txt file I am not able to play with the results ...
0
votes
1answer
129 views

Safest & Secure Way To Store People's Login Information?

I am looking to create an application that aggregates data from people's online accounts. The application (Frontend made with HTML/CSS/PHP and Backend made with Python) will log into people's ...
1
vote
3answers
268 views

Ken Thompson's compiler hack

I have gone through Ken Thompson's compiler hack paper; can't we just go through the compiler's source code and check for any backdoor, what was the article's point? Can we be sure that there are no ...
0
votes
1answer
67 views

Measuring performance time for TLS handshake

I have this sample code to measure TLS handshake performance time. The result I get is: 3.43 ms. By repeating this for 1000 time, I get the minimum time below 1 ms. I use a device with a public IP ...
1
vote
1answer
46 views

Loading a passphrase-protected private SSH key from a file with the cryptography Python module

I am trying to load a passphrase-protected private SSH key from a file using the cryptography Python module. However, I'm not exactly sure how to proceed. The following yields a Crypto.Util.Padding....
0
votes
0answers
57 views

Introduce a SQLi in a testing application

So I was building an application to demonstrate SQL injection via cookies and wrote some code to run SQL statements if the statement are passed within a redir cookie header but when using sqlmap to ...
2
votes
2answers
87 views

Python Pickle Deserialisation attack

I know that untrusted data retrieved from a user should not be serialised/deserialised by an application because it can lead to a remote code execution. What if that input is encoded upon retrieval ...
1
vote
1answer
195 views

Securing Flask admin pages

We've been developing a Flask app for a customer and a part of the agreement was that "customer admins" would be allowed to access Flask admin page to manage users, roles and business entities. The ...
0
votes
0answers
22 views

Is it possible to block non-PyPI requests during pip install?

In 2017 and 2018 there were these infamous stories about malicious packages being uploaded to the PyPI (Python Package Index) which tried to do all sorts of things (collecting and sending data, ...
0
votes
2answers
100 views

SQLi with quote filter?

I'm doing some hacking courses, and in one of the lessons, I have a possible SQLi, but in the Python source code there's an if clause just before the SQL statement, which filters the quote symbol: ...
1
vote
0answers
30 views

Does Windows log program launches?

I wrote a Python script to automate mounting my Veracrypt-encrypted file. The password is provided via standard input (without echoing). os.system('veracrypt /hash whirlpool /l K /p "' + password + ...
0
votes
1answer
27 views

Extensions and Modules and Packages, Oh My! [closed]

How do you know if extensions (e.g., Code, Chrome, Firefox), modules (e.g., PowerShell), or packages (e.g., Python, R) are not malicious? How can you control or monitor that in an environment? Stuff ...
0
votes
0answers
56 views

How to properly store OAuth 2.0 client_id and client_secret in a web application?

In the PoC (Proof of Concept) that I'm currently developing, data from an API is consumed and OAuth 2.0 is required for authentication. The application is already working as expected, the users are ...
1
vote
0answers
186 views

Weird Python script found on a Mac Os X client machine

I was reviewing a Mac Os X machine (a late 2016 MacBook Pro) and I found some weird scripts in the LaunchAgent folder. 8 -rw-r--r-- 1 XX wheel 500 30 Lug 07:18 com.1e1zq.plist 8 -rw-r--r-- 1 XX ...
1
vote
1answer
27 views

Why do processes on servers have socket types associated to the port number? [closed]

Why do some servers have TCP/UDP alongside the port they're listening to. To my understanding TCP and UDP are socket layers, they're methods of determining how the traffic is being sent over the ...
1
vote
0answers
106 views

How can an absolute beginner begin with cyber security? [closed]

I am an absolute beginner in coding/computer science and want to pursue a particular role in cyber security open to all degrees (I am studying chemical engineering). Can anyone recommend what I should ...
2
votes
1answer
99 views

Can't log in dvwa with a simple python program, even though login credentials are good

import requests target_url = "http://127.0.0.1/dvwa/login.php" data_dict = {"csrfmiddlewaretoken": "bbbfeed6e1aea50f14a51a331054022c", "username": "admin", "password": "password", "Login": "Submit"} ...
4
votes
1answer
703 views

Metasploit is not detecting newly imported python exploit

I have added OpenSSH 7.2p2 - Username Enumeration exploit to Metasploit, which is a python exploit. But after so, it does not detect that exploit every way I tried. I have placed it under the ...
0
votes
0answers
201 views

Are there any tools to detect JPEG steganography? [duplicate]

I am looking for tools which can detect JPEG steganography for Windows or Linux. All the projects I found are either so old that they are missing dependencies and there are no precompiled binaries. ...
2
votes
1answer
111 views

Scanning a binary against YARA rules dictionary

I have found a malware binary, Which i am curious to see what patterns has been found from this file. Also i have a collection of ~1000 ioc's and yara-rule's related to Malwares and RAT's. I used Loki,...
0
votes
1answer
34 views

Hosting statistic tool on heroku with flask secure?

I am working on a statistic tool for our company, millions of datasets. Now I need to upload the project, so all company members can request data from everywhere. I am working with Python 3/Flask and ...
4
votes
1answer
146 views

How to check if Certificate from Certificate Log is revoked?

I have a DB with certs from CTL. (using 'certstream' utility). Here's an example of one set of certificate data: { "all_domains" : [ "benesseresalus.com", "benesseresalus.it", "...
0
votes
1answer
43 views

Python hazmat danger

Is hazmat considered to be secure? Here is a quote from their docs: This is a “Hazardous Materials” module. You should ONLY use it if you’re 100% absolutely sure that you know what you’re doing ...
1
vote
1answer
104 views

Is using JSON a secure way of handling sql queries in python?

The question I will try to articulate this as clearly and best I can: Suppose that I have a python program which connects to a database on a server. Next I ask you to consider that this python ...
1
vote
1answer
57 views

How can I make sure that my Python code cannot be accessed by the user of my web app?

I have a Python Program whose code I would like to protect. For sake of example, let's say I coded a novel function called "add" which does the following: def add(n1, n2): return n1 + n2 I'd ...
0
votes
1answer
100 views

How to force users on my LAN to use a specific DNS server with arp poisoning?

I'm attempting to force all hosts on my LAN to use a specific DNS server to filter certain material, however I'm running into problems. I've had problems in the past trying to configure my router's ...
1
vote
2answers
61 views

Check uploaded python script for security issues before running it

I would be allowing a user to upload Python scripts and would execute them on my server. The base application is in Java and I am using ProcessBuilder to get Python to run from my Java application. ...
-1
votes
2answers
158 views

Testing RCE and SSRF using Python SimpleHTTPServer [closed]

Is it possible to test RCE and SSRF vulnerabilities using Python SimpleHTTPServer? Or should I use a VPS server?
0
votes
1answer
173 views

Analyzing Apache log with Snort

I need to analyze an Apache log with Snort and others IDS/WAFs (Suricata, mod_security and Shadow Daemon). In order to do so, I was thinking about create TCP packets with the GET and POST requests ...
0
votes
0answers
183 views

How to use binary search for blind SQL injection queries

From what I read online, it's possible to apply binary search to exploit blind SQL injection vulnerabilities, and that is probably what tools like sqlmap use to lower the number of queries that need ...
1
vote
2answers
338 views

Linux command to wipe files on an SD Card?

Are there any commands, tools or python libraries to securely wipe specific files from an SD or micro SD card (devices that use flash memory)? For example, with a regular magnetic hard drive, you can ...
0
votes
1answer
273 views

Why do OpenSSL and Python return different SSL fingerprints?

I use getmail, a tool written in Python, to retrieve my mail via IMAP. Today it suddenly stopped working because it complains about an SSL fingerprint mismatch. (I always specify the fingerprint to ...
2
votes
2answers
300 views

Protecting Python source code on physical product?

How would you protect Python source code on a physical product (like a IoT device), which comes with Ubuntu installed on a mini-PC running Python code? Few methods we thought about: Compiling the ...
0
votes
1answer
313 views

How to avoid XML vulnerabilities in Python?

I am writing a suite of Python 3 applications (including first a command line utility, second an HTTP(S) proxy) which deal with XML. Today I've discovered that there are several vulnerabilities ...
2
votes
1answer
190 views

Is it as safe to use a programming language as a browser? [closed]

To browse the internet on sensitive websites (government websites, banks, etc...), is it as safe to use a modern web browser as a programming language? Specifically, python + requests + beautifulSoup ...
1
vote
1answer
214 views

Developing MIPS exploit in python memory address getting parse as a value [closed]

I am trying to develop an exploit in python. but I am not able to write an proper exploit. Below are the scenarios were i am facing problem. below is the HTTP request which occurs the crash POST /...
3
votes
1answer
528 views

Python - ctypes.cast function call outputs Segmentation Fault error message

Background: Writing a proof of concept of a twitter C&C inspired by Prof Viviek of SPSE similiar to twittor and the project includes a functionality of injecting shellcode and executing it ...
1
vote
1answer
91 views

Fuzzing: Quickly find the exact number of bytes

I'm currently practicing buffer overflow. And I have a question for you regarding fuzzing. I am able to develop a python script that will try several buffer sizes to crash an application. It works ...
0
votes
2answers
156 views

Security-wise, is an in-browser JavaScript implementation fundamentally different from a server-side language (e.g. Python) implementation?

As I understand it, JavaScript implementations running in browsers need to run untrusted code and operate on untrusted data in a secure manner. Language (e.g. Python) implementations running on a ...
5
votes
3answers
825 views

Safely load a pickle file?

In our Python app, we are using pickle.load to load a file named perceptron.pkl. A HP Fortify static scan raises a high vulnerability, "Dynamic Code Evaluation - Unsafe Pickle Deserialization", at the ...
0
votes
2answers
312 views

Dictionary Attack on SHA-1 hashes [closed]

The following is a Python code to crack SHA1 hash. This code does not seem to work. import hashlib # plug in the hash that needs to be cracked hash_to_crack = "...
1
vote
1answer
327 views

How to best hash patient names to generate a pseudonym?

I am working on a data acquisition and preprocessing tool for a brain tumor database. The tool preprocesses the data and harmonizes it so it can be united in a one big database. Due to privacy ...
2
votes
1answer
599 views

stdin does not wait for next input after ROP chain

I was trying to exploit a vulnerability in a ctf but I can not make fgets() reopen stdin to put my second stage ROP chain. I am using pwntool but the problem is more socket oriented. I recreated ...
0
votes
2answers
161 views

Is it secure not to set a user in django admin?

Is it possible for someone to hack into my django admin app, if I do not create a user for it, by executing: python manage.py createsuperuser For example, is there a default username-password pair ...