Posts by Ed S • 2,057 points
164 posts
-
14
votes1
answer1251
viewsQ: Demonstrating a slowloris attack on apache server using Python
I have the network dump (file in PCAP format captured with tcpdump) of a "chat" between the attacked server (Apache web server: 192.168.1.2) and the malicious clients: The attack was a simulation in…
-
0
votes2
answers192
viewsQ: Generating a file that is output from a command only if a condition is met
Be the command: top -o %MEM -b > file.txt I would like you to file.txt only the values that are between two time periods, for example: between 07 April 2017 07h and 07 April 2017 12h. Is it…
-
0
votes1
answer293
viewsQ: Apache server stopped recording accesses to the access file.
I am running a Ddos attack experiment on a virtual apache server (Vmware). The attack was on the apache service and not the machine. From a certain time (10:20 a.m.), although there were machines…
-
0
votes1
answer742
viewsQ: Converting a text file to XML with Python
Imagine I have the following command: echo -e "`date`\n\n`free`\n\n`vmstat`\n" >> free_vmstat_output.txt the generated file (the output of the above command) would be (in TEXT mode): Fri Mar…
-
3
votes1
answer300
viewsQ: Apache logs: checking a slowloris attack
I’m simulating an attack slowloris to a Debian server running Apache. The attacking machines are Debian as well. In order to make sure that the attack slowloris was effective, would like to access…
-
0
votes0
answers108
viewsQ: Extracting source and destination IP to check if the server has become inoperative after attack
from scapy.all import * from collections import deque def print_attack_measure(pcap_file): plist = rdpcap(pcap_file) server_ip = "192.168.1.5" n = 300 d = deque(maxlen=n) # If you want…
-
0
votes2
answers356
viewsA: Checking a Dos/Ddos attack (Denial of service) on a network dump (PCAP file)
from scapy.all import * from collections import deque def print_attack_measure(pcap_file): plist = rdpcap(pcap_file) server_ip = "192.168.1.5" n = 300 d = deque(maxlen=n) # If you want…
-
2
votes2
answers811
viewsQ: Printing specific lines from a text file
Imagine that I have a text file called test.txt with the following content: 4 Março 2017- Sábado meu aniversario -prova de calculo 6 Março 2017- Segunda aniversario do Salomao - fazer compras 8…
-
1
votes1
answer477
viewsQ: Web scraping at a specific url with Beautifulsoup
from bs4 import BeautifulSoup import requests import re url = 'http://www.bhaktiyogapura.com/2017/03/calendario-vaisnava-marco-de-2017/' header = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64;…
-
2
votes2
answers356
viewsQ: Checking a Dos/Ddos attack (Denial of service) on a network dump (PCAP file)
from scapy.all import * import dpkt f1 = open("semAtaque.pcap") pcap = dpkt.pcap.Reader(f1) f1.close() f2 = open("Ataques.pcap") pcap = dpkt.pcap.Reader(f2) f2.close() I have two network traffic…
-
0
votes1
answer106
viewsQ: Traversing a file and splitting its contents into other separate files using Python
from scapy.all import * pkts = rdpcap("lalalao2.pcap") #time slice de t em segundos : 10 minutos t = 600 somaMin = pkts[0].time + t valores=[] for p in pkts: if p<=somaMin: valores.append(p)…
-
0
votes1
answer322
viewsQ: How to filter PCAP file with Python?
The PCAP file was generated on 12/21/2016 and is 5 GB so it is impractical to try to open it with wireshark (graphical user interface) I installed tshark on Ubuntu and while reading the manual, I…
-
0
votes1
answer187
viewsQ: Writing IP addresses to file, each IP on a different line using Python
from scapy.all import * pkts = rdpcap("lalalao.pcap") for p in pkts: ## print p.time if IP in p: #if packet has IP layer src_ip = p[IP].src dest_ip = p[IP].dst print src_ip f = open('IP_src.txt',…
-
1
votes1
answer119
viewsQ: How to make a "time-Slice" in packages in a network dump with Python?
I’m trying to "grab" source Ips and target Ips inside a network dump (PCAP) file. The idea is to save all source Ips and all target IPS by scanning the file every 10 minutes ("time-Slice"), for…
-
1
votes2
answers795
viewsQ: Read files . CAP efficiently with Python
I have some. CAP files originated from catching packages with tcpdump. When trying to open with wireshark, the machine gets very slow, because I imagine he tries to load everything to RAM. I would…
-
2
votes1
answer562
viewsQ: Calculation of Shannon entropy in network traffic (saved in CAP file) using Python
I have a dump file (CAP format) of a network traffic capture made with Ubuntu’s tcp dump. Until a certain time, it is a traffic free of attacks. Then, begin a series of attacks of type TCP SYN…
-
0
votes3
answers331
viewsQ: Avoiding code duplication without the use of switch/case in the Python language
Friends, I have the following code in Python: data_hoje = time.strftime("%d %b %Y", time.gmtime() ) #data de hoje data_desejada = time.strftime("%d %b %Y", time.gmtime(time.time() + (3600 * 24 *…
-
0
votes1
answer703
viewsQ: With doing Facebook posts with Python?
import facebook token = 'meu token' graph = facebook.GraphAPI(token) graph.put_object("me", "feed", message="Hello, World!") Friends, I’m using Ubuntu and Python 2.7 and 3.5.2 The following error…
-
1
votes1
answer1336
viewsQ: Python data extraction and automatic email sending with information obtained
Friends, The data extraction part is working and the email sending is also in part. I would like the same information that I print on screen and with the same formatting (skipping line etc)) to be…
-
1
votes1
answer264
viewsQ: Extract data from a calendar with Python and Beautifulsoup (under Linux Ubuntu-like)
Friends, I’d like to take data from a calendar: http://www.purebhakti.com/component/panjika The first step would be to make the program choose the time zone ( -3:00 Buenos Aires) and click on Submit…
-
2
votes1
answer6497
viewsQ: Creating a chat program. How to make two talk simultaneously?
# -*- coding: utf-8 -*- #!/usr/bin/python3 import socket # nao tem servidor UDP no google -> vamos usar netcat como servidor UDP! #Programa de chat: so fala um de cada vez #implementar falando ao…
-
1
votes3
answers465
viewsA: how to show the matrix in matrix form and not the numbers arranged on each other’s side?
I found the following mistake: for iLin:=1 to 3 do begin for iCol:=1 to 3 do gotoxy (iCol,iLin); write (iMat[iLin,iCol]); end Missed a Begin before Gotoxy. Correcting: program teste; uses crt; var…
-
-4
votes3
answers465
viewsQ: how to show the matrix in matrix form and not the numbers arranged on each other’s side?
I did but it didn’t work: program teste; uses crt; var iMat: array [1..3,1..3] of integer; iLin, iCol: integer; begin write ('Digite os números da matriz: '); for iLin:=1 to 3 do begin for iCol:=1…
-
0
votes1
answer758
viewsA: Change place characters - C
I believe this code solves the problem... #include <stdlib.h> #include <stdio.h> int main(int argc, char** argv){ char string[101]; char letra[2]; char comp[3]="ay"; int count, i;…
-
0
votes1
answer758
viewsQ: Change place characters - C
I need to write a C program that takes a word (string) as a parameter and generates a new string consisting of the original string with the following changes: The first character of the string must…
-
1
votes7
answers52205
viewsA: Is there a way to print everything without breaking the line?
print 't' + 'e' + 's' + 't' + 'e' The default print always does a line break at the end, if you want, you can write straight into sys.stdout which will not have line break import sys…
-
11
votes7
answers52205
viewsQ: Is there a way to print everything without breaking the line?
I have this code: print "t" print "e" print "s" print "t" print "e" He’s got a way out: t e s t e What I find very boring these "\n". There is a way to print everything without line break?…
-
0
votes1
answer131
viewsA: Error executing GUI application in Python 3
Try this: sudo apt-get install python3-tk
-
0
votes1
answer131
viewsQ: Error executing GUI application in Python 3
Error executing GUI application in Python 3. File "/home/nexide/PycharmProjects/untitled1/.idea/testew.py", line 1, in <module> from tkinter import * ImportError: No module named tkinter…
-
0
votes1
answer215
viewsA: Netcat on Linux
In some operating systems netcat does not have the option -e for security, so in some cases it is necessary to create an alternative to netcat with python, for example. In addition there are some…
-
0
votes1
answer215
viewsQ: Netcat on Linux
I tried using netcat with the -e option and the following error occurred; netcat: invalid option -- 'e' This is nc from the netcat-openbsd package. An alternative nc is available in the…
-
-2
votes3
answers31234
viewsA: How to print skipping lines (each variable in a row)?
print 'Nome: '+nome + '\n' + 'Trabalho: '+profissao + '\n' + 'Escola: ' +escola+ '\n' + 'Idade: '+str(idade)+ ' anos' Just use the character \n in the phrase locations you want to skip the line.…
-
2
votes3
answers31234
viewsQ: How to print skipping lines (each variable in a row)?
How to print skipping lines (each variable in a row)? nome ='Paulo' profissao = 'estudante' escola = 'estadual dourado' idade = 18 print 'Nome: '+nome + 'Trabalho: '+profissao + 'Escola: ' +escola+…
-
-1
votes1
answer828
viewsA: Creating an executable file of a python program in windows 10
The mistake "the program cant start because msvcr100.dll is Missing:" can be solved by installing Microsoft Visual C++.
-
0
votes1
answer2155
viewsA: How to read two whole variables on the same line?
The code below should help: N, M = [int(x) for x in input().split(" ")]
-
-1
votes1
answer2155
viewsQ: How to read two whole variables on the same line?
How to read two integer variables on the same line with Python? a= int(input()) b = int(input())
-
2
votes1
answer1014
viewsA: Is there any way to read an XLS file and manipulate it in Python?
import xlrd def xlread(arq_xls): """ Gerador que le arquivo .xls """ # Abre o arquivo xls = xlrd.open_workbook(arq_xls) # Pega a primeira planilha do arquivo plan = xls.sheets()[0] # Para i de zero…
-
1
votes1
answer1014
viewsQ: Is there any way to read an XLS file and manipulate it in Python?
Is there any way to read an XLS file and manipulate it in Python? Does any library allow this?
-
-2
votes3
answers1852
viewsA: Reading blank blank blank blank blank files
arquivo = open("arquivo.txt", "r") for linhas in arquivo: linhas = arquivo.read().splitlines()
-
1
votes3
answers1852
viewsQ: Reading blank blank blank blank blank files
How do I avoid reading a blank line in a file, to any operating system, using the Python language?
-
1
votes1
answer1573
viewsA: Program that creates two vectors with 10 random elements between 1 and 100
If you use the Sort method we will not be able to know if the elements are interspersed. An example: lista1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] and lista2 = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20].…
-
-2
votes1
answer1573
viewsQ: Program that creates two vectors with 10 random elements between 1 and 100
Make a program that creates two vectors with 10 random elements between 1 and 100. Generate a third vector of 20 elements, whose values should be composed of the interspersed elements of the two…
-
1
votes2
answers1216
viewsA: input() and raw_input()
In Python 2 there are functions input and raw_input, but the first is rarely used because it only accepts syntactically valid literals, i.e., numbers, or strings between quotation marks, etc. The…
-
1
votes2
answers1216
viewsQ: input() and raw_input()
According to the Python 2.x documentation, it is recommended to use the function raw_input instead of input. Conversely, in the Python 3.x documentation, the function raw_input doesn’t even appear.…
-
0
votes1
answer132
viewsA: I have latex error in windows 10 32 bits
You already installed Miktex on Windows 10? Download into: http://miktex.org/download
-
0
votes1
answer67
viewsA: Ubuntu error: NO_PUBKEY 8BAF9A6F
Run on the terminal: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8BAF9A6F and then: sudo apt-get update Will solve!…
-
-1
votes1
answer67
viewsQ: Ubuntu error: NO_PUBKEY 8BAF9A6F
My Ubuntu started giving the following error: W: GPG error: http://ppa.launchpad.net Trusty Inrelease: The following Signatures couldn’t be verified because the public key is not available:…
-
1
votes3
answers109
viewsA: Error in compiling ola mundo
apt-get install gcc Alter #include <stdlib> for #include <stdlib.h>
-
0
votes3
answers109
viewsQ: Error in compiling ola mundo
#include <stdlib> int main() { printf("Ola Mundo!\n"); return 0; } I can’t run the program on Ubuntu! Build error
-
0
votes1
answer224
viewsQ: How to get the headlines of the Olympics on the CNN website with Python using Beautifulsoup?
I’d like an example of how to take the headlines of the Olympics in http://edition.cnn.com/sport/olympics using Beautifulsoup.…