How to use xxx method in avocado

Best Python code snippet using avocado_python

testlengths.py

Source:testlengths.py Github

copy

Full Screen

1#!/usr/bin/env python2# -*- coding: utf-8 -*-3# Copyright (C) 2007 Søren Roug, European Environment Agency4#5# This is free software. You may redistribute it under the terms6# of the Apache license and the GNU General Public License Version7# 2 or at your option any later version.8#9# This program is distributed in the hope that it will be useful,10# but WITHOUT ANY WARRANTY; without even the implied warranty of11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12# GNU General Public License for more details.13#14# You should have received a copy of the GNU General Public15# License along with this program; if not, write to the Free Software16# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA17#18# Contributor(s):19#20import unittest21from odf import chart, draw, presentation, style, svg22from odf.element import IllegalChild23class TestDrawElements(unittest.TestCase):24 def test_calls(self):25 """ Simple calls """26 chart.Chart( attributes={'class':'chart:bar'}, height="0cm" )27 chart.Chart( attributes={'class':'chart:bar'}, width="0cm" )28 draw.AreaCircle( cy="1cm", cx="1cm", r="0cm" )29 draw.AreaPolygon( height="1cm", points="0,0 1,1", y="1cm", x="1cm", viewbox="0 0 1000 1000", width="0cm" )30 draw.AreaPolygon( height="1cm", width="1cm", points="0,0 1,1", x="1cm", viewbox="0 0 1000 1000", y="0cm" )31 draw.AreaPolygon( height="1cm", width="1cm", points="0,0 1,1", y="1cm", viewbox="0 0 1000 1000", x="0cm" )32 draw.AreaPolygon( width="1cm", points="0,0 1,1", y="1cm", x="1cm", viewbox="0 0 1000 1000", height="0cm" )33 draw.AreaRectangle( x="1cm", height="1cm", width="1cm", y="0cm" )34 draw.AreaRectangle( y="1cm", height="1cm", width="1cm", x="0cm" )35 draw.AreaRectangle( y="1cm", x="1cm", height="1cm", width="0cm" )36 draw.AreaRectangle( y="1cm", x="1cm", width="1cm", height="0cm" )37 draw.ContourPath( recreateonedit="true", viewbox="0 0 1000 1000", d="1cm", height="0cm" )38 draw.ContourPath( recreateonedit="true", viewbox="0 0 1000 1000", d="1cm", width="0cm" )39 draw.ContourPolygon( points="0,0 1,1", recreateonedit="true", viewbox="0 0 1000 1000", height="0cm" )40 draw.ContourPolygon( points="0,0 1,1", recreateonedit="true", viewbox="0 0 1000 1000", width="0cm" )41 draw.Control( control="1cm", endx="0cm" )42 draw.Control( control="1cm", endy="0cm" )43 draw.Control( control="1cm", height="0cm" )44 draw.Control( control="1cm", width="0cm" )45 draw.Control( control="1cm", x="0cm" )46 draw.Control( control="1cm", y="0cm" )47 draw.FillImage( href="1cm", type="simple", name="1cm", height="0cm" )48 draw.FillImage( href="1cm", type="simple", name="1cm", width="0cm" )49 draw.GluePoint( x="1cm", align="1cm", id="1cm", y="0cm", escapedirection="right" )50 draw.GluePoint( y="1cm", align="1cm", id="1cm", x="0cm", escapedirection="right" )51 draw.Line( x2="1cm", x1="1cm", y2="1cm", y1="0cm" )52 draw.Line( y1="1cm", x1="1cm", y2="1cm", x2="0cm" )53 draw.Line( y1="1cm", x2="1cm", x1="1cm", y2="0cm" )54 draw.Line( y1="1cm", x2="1cm", x1="1cm", y2="1cm", endx="0cm" )55 draw.Line( y1="1cm", x2="1cm", x1="1cm", y2="1cm", endy="0cm" )56 draw.Line( y1="1cm", x2="1cm", y2="1cm", x1="0cm" )57 draw.Measure( x2="1cm", x1="1cm", y2="1cm", y1="0cm" )58 draw.Measure( y1="1cm", x1="1cm", y2="1cm", x2="0cm" )59 draw.Measure( y1="1cm", x2="1cm", x1="1cm", y2="0cm" )60 draw.Measure( y1="1cm", x2="1cm", x1="1cm", y2="1cm", endx="0cm" )61 draw.Measure( y1="1cm", x2="1cm", x1="1cm", y2="1cm", endy="0cm" )62 draw.Measure( y1="1cm", x2="1cm", y2="1cm", x1="0cm" )63 draw.Path( d="1cm", viewbox="0 0 1000 1000", endx="0cm" )64 draw.Path( d="1cm", viewbox="0 0 1000 1000", endy="0cm" )65 draw.Path( d="1cm", viewbox="0 0 1000 1000", height="0cm" )66 draw.Path( d="1cm", viewbox="0 0 1000 1000", width="0cm" )67 draw.Path( d="1cm", viewbox="0 0 1000 1000", x="0cm" )68 draw.Path( d="1cm", viewbox="0 0 1000 1000", y="0cm" )69 draw.Polygon( points="0,0 1,1", viewbox="0 0 1000 1000", endx="0cm" )70 draw.Polygon( points="0,0 1,1", viewbox="0 0 1000 1000", endy="0cm" )71 draw.Polygon( points="0,0 1,1", viewbox="0 0 1000 1000", height="0cm" )72 draw.Polygon( points="0,0 1,1", viewbox="0 0 1000 1000", width="0cm" )73 draw.Polygon( points="0,0 1,1", viewbox="0 0 1000 1000", x="0cm" )74 draw.Polygon( points="0,0 1,1", viewbox="0 0 1000 1000", y="0cm" )75 draw.Polyline( points="0,0 1,1", viewbox="0 0 1000 1000", endx="0cm" )76 draw.Polyline( points="0,0 1,1", viewbox="0 0 1000 1000", endy="0cm" )77 draw.Polyline( points="0,0 1,1", viewbox="0 0 1000 1000", height="0cm" )78 draw.Polyline( points="0,0 1,1", viewbox="0 0 1000 1000", width="0cm" )79 draw.Polyline( points="0,0 1,1", viewbox="0 0 1000 1000", x="0cm" )80 draw.Polyline( points="0,0 1,1", viewbox="0 0 1000 1000", y="0cm" )81 draw.RegularPolygon( corners="1cm", endx="0cm" )82 draw.RegularPolygon( corners="1cm", endy="0cm" )83 draw.RegularPolygon( corners="1cm", height="0cm" )84 draw.RegularPolygon( corners="1cm", width="0cm" )85 draw.RegularPolygon( corners="1cm", x="0cm" )86 draw.RegularPolygon( corners="1cm", y="0cm" )87 draw.StrokeDash( name="1cm", dots1length="0cm" )88 draw.StrokeDash( name="1cm", dots2length="0cm" )89 presentation.Placeholder( x="1cm", height="1cm", object="1cm", width="1cm", y="0cm" )90 presentation.Placeholder( y="1cm", height="1cm", object="1cm", width="1cm", x="0cm" )91 presentation.Placeholder( y="1cm", x="1cm", height="1cm", object="1cm", width="0cm" )92 presentation.Placeholder( y="1cm", x="1cm", object="1cm", width="1cm", height="0cm" )93 style.Column( relwidth="1cm", endindent="0cm" )94 style.Column( relwidth="1cm", spaceafter="0cm" )95 style.Column( relwidth="1cm", spacebefore="0cm" )96 style.Column( relwidth="1cm", startindent="0cm" )97 style.Columns( columncount="1cm", columngap="0cm" )98 style.TabStop( position="0cm" )99 svg.Lineargradient( name="1cm", x1="0cm" )100 svg.Lineargradient( name="1cm", x2="0cm" )101 svg.Lineargradient( name="1cm", y1="0cm" )102 svg.Lineargradient( name="1cm", y2="0cm" )103 svg.Radialgradient( name="1cm", r="0cm" )104 def test_invalid_length(self):105 """ Fail is the length is invalid """106 self.assertRaises(ValueError, chart.Chart, attributes={'class':'chart:bar'}, height="xxx" )107 self.assertRaises(ValueError, chart.Chart, attributes={'class':'chart:bar'}, width="xxx" )108 self.assertRaises(ValueError, draw.AreaCircle, cy="1cm", cx="1cm", r="xxx" )109 self.assertRaises(ValueError, draw.AreaPolygon, height="1cm", points="0,0 1,1", y="1cm", x="1cm", viewbox="0 0 1000 1000", width="xxx" )110 self.assertRaises(ValueError, draw.AreaPolygon, height="1cm", width="1cm", points="0,0 1,1", x="1cm", viewbox="0 0 1000 1000", y="xxx" )111 self.assertRaises(ValueError, draw.AreaPolygon, height="1cm", width="1cm", points="0,0 1,1", y="1cm", viewbox="0 0 1000 1000", x="xxx" )112 self.assertRaises(ValueError, draw.AreaPolygon, width="1cm", points="0,0 1,1", y="1cm", x="1cm", viewbox="0 0 1000 1000", height="xxx" )113 self.assertRaises(ValueError, draw.AreaRectangle, x="1cm", height="1cm", width="1cm", y="xxx" )114 self.assertRaises(ValueError, draw.AreaRectangle, y="1cm", height="1cm", width="1cm", x="xxx" )115 self.assertRaises(ValueError, draw.AreaRectangle, y="1cm", x="1cm", height="1cm", width="xxx" )116 self.assertRaises(ValueError, draw.AreaRectangle, y="1cm", x="1cm", width="1cm", height="xxx" )117 self.assertRaises(ValueError, draw.ContourPath, recreateonedit="true", viewbox="0 0 1000 1000", d="1cm", height="xxx" )118 self.assertRaises(ValueError, draw.ContourPath, recreateonedit="true", viewbox="0 0 1000 1000", d="1cm", width="xxx" )119 self.assertRaises(ValueError, draw.ContourPolygon, points="0,0 1,1", recreateonedit="true", viewbox="0 0 1000 1000", height="xxx" )120 self.assertRaises(ValueError, draw.ContourPolygon, points="0,0 1,1", recreateonedit="true", viewbox="0 0 1000 1000", width="xxx" )121 self.assertRaises(ValueError, draw.Control, control="1cm", endx="xxx" )122 self.assertRaises(ValueError, draw.Control, control="1cm", endy="xxx" )123 self.assertRaises(ValueError, draw.Control, control="1cm", height="xxx" )124 self.assertRaises(ValueError, draw.Control, control="1cm", width="xxx" )125 self.assertRaises(ValueError, draw.Control, control="1cm", x="xxx" )126 self.assertRaises(ValueError, draw.Control, control="1cm", y="xxx" )127 self.assertRaises(ValueError, draw.FillImage, href="1cm", name="1cm", height="xxx" )128 self.assertRaises(ValueError, draw.FillImage, href="1cm", name="1cm", width="xxx" )129 self.assertRaises(ValueError, draw.GluePoint, x="1cm", align="1cm", id="1cm", y="xxx", escapedirection="right" )130 self.assertRaises(ValueError, draw.GluePoint, y="1cm", align="1cm", id="1cm", x="xxx", escapedirection="right" )131 self.assertRaises(ValueError, draw.Line, x2="1cm", x1="1cm", y2="1cm", y1="xxx" )132 self.assertRaises(ValueError, draw.Line, y1="1cm", x1="1cm", y2="1cm", x2="xxx" )133 self.assertRaises(ValueError, draw.Line, y1="1cm", x2="1cm", x1="1cm", y2="xxx" )134 self.assertRaises(ValueError, draw.Line, y1="1cm", x2="1cm", x1="1cm", y2="1cm", endx="xxx" )135 self.assertRaises(ValueError, draw.Line, y1="1cm", x2="1cm", x1="1cm", y2="1cm", endy="xxx" )136 self.assertRaises(ValueError, draw.Line, y1="1cm", x2="1cm", y2="1cm", x1="xxx" )137 self.assertRaises(ValueError, draw.Measure, x2="1cm", x1="1cm", y2="1cm", y1="xxx" )138 self.assertRaises(ValueError, draw.Measure, y1="1cm", x1="1cm", y2="1cm", x2="xxx" )139 self.assertRaises(ValueError, draw.Measure, y1="1cm", x2="1cm", x1="1cm", y2="xxx" )140 self.assertRaises(ValueError, draw.Measure, y1="1cm", x2="1cm", x1="1cm", y2="1cm", endx="xxx" )141 self.assertRaises(ValueError, draw.Measure, y1="1cm", x2="1cm", x1="1cm", y2="1cm", endy="xxx" )142 self.assertRaises(ValueError, draw.Measure, y1="1cm", x2="1cm", y2="1cm", x1="xxx" )143 self.assertRaises(ValueError, draw.Path, d="1cm", viewbox="0 0 1000 1000", endx="xxx" )144 self.assertRaises(ValueError, draw.Path, d="1cm", viewbox="0 0 1000 1000", endy="xxx" )145 self.assertRaises(ValueError, draw.Path, d="1cm", viewbox="0 0 1000 1000", height="xxx" )146 self.assertRaises(ValueError, draw.Path, d="1cm", viewbox="0 0 1000 1000", width="xxx" )147 self.assertRaises(ValueError, draw.Path, d="1cm", viewbox="0 0 1000 1000", x="xxx" )148 self.assertRaises(ValueError, draw.Path, d="1cm", viewbox="0 0 1000 1000", y="xxx" )149 self.assertRaises(ValueError, draw.Polygon, points="0,0 1,1", viewbox="0 0 1000 1000", endx="xxx" )150 self.assertRaises(ValueError, draw.Polygon, points="0,0 1,1", viewbox="0 0 1000 1000", endy="xxx" )151 self.assertRaises(ValueError, draw.Polygon, points="0,0 1,1", viewbox="0 0 1000 1000", height="xxx" )152 self.assertRaises(ValueError, draw.Polygon, points="0,0 1,1", viewbox="0 0 1000 1000", width="xxx" )153 self.assertRaises(ValueError, draw.Polygon, points="0,0 1,1", viewbox="0 0 1000 1000", x="xxx" )154 self.assertRaises(ValueError, draw.Polygon, points="0,0 1,1", viewbox="0 0 1000 1000", y="xxx" )155 self.assertRaises(ValueError, draw.Polyline, points="0,0 1,1", viewbox="0 0 1000 1000", endx="xxx" )156 self.assertRaises(ValueError, draw.Polyline, points="0,0 1,1", viewbox="0 0 1000 1000", endy="xxx" )157 self.assertRaises(ValueError, draw.Polyline, points="0,0 1,1", viewbox="0 0 1000 1000", height="xxx" )158 self.assertRaises(ValueError, draw.Polyline, points="0,0 1,1", viewbox="0 0 1000 1000", width="xxx" )159 self.assertRaises(ValueError, draw.Polyline, points="0,0 1,1", viewbox="0 0 1000 1000", x="xxx" )160 self.assertRaises(ValueError, draw.Polyline, points="0,0 1,1", viewbox="0 0 1000 1000", y="xxx" )161 self.assertRaises(ValueError, draw.RegularPolygon, corners="1cm", endx="xxx" )162 self.assertRaises(ValueError, draw.RegularPolygon, corners="1cm", endy="xxx" )163 self.assertRaises(ValueError, draw.RegularPolygon, corners="1cm", height="xxx" )164 self.assertRaises(ValueError, draw.RegularPolygon, corners="1cm", width="xxx" )165 self.assertRaises(ValueError, draw.RegularPolygon, corners="1cm", x="xxx" )166 self.assertRaises(ValueError, draw.RegularPolygon, corners="1cm", y="xxx" )167 self.assertRaises(ValueError, draw.StrokeDash, name="1cm", dots1length="xxx" )168 self.assertRaises(ValueError, draw.StrokeDash, name="1cm", dots2length="xxx" )169 self.assertRaises(ValueError, presentation.Placeholder, x="1cm", height="1cm", object="1cm", width="1cm", y="xxx" )170 self.assertRaises(ValueError, presentation.Placeholder, y="1cm", height="1cm", object="1cm", width="1cm", x="xxx" )171 self.assertRaises(ValueError, presentation.Placeholder, y="1cm", x="1cm", height="1cm", object="1cm", width="xxx" )172 self.assertRaises(ValueError, presentation.Placeholder, y="1cm", x="1cm", object="1cm", width="1cm", height="xxx" )173 self.assertRaises(ValueError, style.Column, relwidth="1cm", endindent="xxx" )174 self.assertRaises(ValueError, style.Column, relwidth="1cm", spaceafter="xxx" )175 self.assertRaises(ValueError, style.Column, relwidth="1cm", spacebefore="xxx" )176 self.assertRaises(ValueError, style.Column, relwidth="1cm", startindent="xxx" )177 self.assertRaises(ValueError, style.Columns, columncount="1cm", columngap="xxx" )178 self.assertRaises(ValueError, style.TabStop, position="xxx" )179 self.assertRaises(ValueError, svg.Lineargradient, name="1cm", x1="xxx" )180 self.assertRaises(ValueError, svg.Lineargradient, name="1cm", x2="xxx" )181 self.assertRaises(ValueError, svg.Lineargradient, name="1cm", y1="xxx" )182 self.assertRaises(ValueError, svg.Lineargradient, name="1cm", y2="xxx" )183 self.assertRaises(ValueError, svg.Radialgradient, name="1cm", r="xxx" )184if __name__ == '__main__':...

Full Screen

Full Screen

Evaluacion Final del Modulo 2.py

Source:Evaluacion Final del Modulo 2.py Github

copy

Full Screen

1import locale2locale.setlocale(locale.LC_ALL, '')3lista = []4while True:5 print("")6 a=str(input("Ingresar valor número: "))7 aaa=str(a.isdigit())8 aaaa=str("True")9 #print(aaa)10 if aaa == aaaa:11 Asx = []12 #bucle para agregar separar los valores númericos13 for i in a:14 i=int(i) #se trasforma en número15 Asx.append(i)16 #print(Asx)17 z=len(Asx)18 19 def imprimir(aa,bb,cc,dd,ee,ff):20 a=" +-+ "21 a1=" | |"22 a2=" | |"23 a3=" | |"24 a4=" | |"25 a5=" | |"26 a6=" | |"27 a7=" | |"28 a8=" | |"29 a9=" | |"30 b=" +-+ " 31 b1=" | |"32 b2=" | |"33 b3=" | |"34 b4=" | |"35 b5=" | |"36 b6=" | |"37 b7=" | |"38 b8=" | |"39 b9=" | |"40 c=" +-+ " 41 c1=" | |"42 c2=" | |"43 c3=" | |"44 c4=" | |"45 c5=" | |"46 c6=" | |"47 c7=" | |"48 c8=" | |"49 c9=" | |"50 d=" +-+ " 51 d1=" | |"52 d2=" | |"53 d3=" | |"54 d4=" | |"55 d5=" | |"56 d6=" | |"57 d7=" | |"58 d8=" | |"59 d9=" | |"60 e=" +-+ " 61 e1=" | |"62 e2=" | |"63 e3=" | |"64 e4=" | |"65 e5=" | |"66 e6=" | |"67 e7=" | |"68 e8=" | |"69 e9=" | |"70 f=" +-+ "71 f1=" | |"72 f2=" | |"73 f3=" | |"74 f4=" | |"75 f5=" | |"76 f6=" | |"77 f7=" | |"78 f8=" | |"79 f9=" | |"80 ##########################################################81 if aa>=1:82 a9=" xxx"83 if aa>=2:84 a8=" xxx"85 if aa>=3:86 a7=" xxx"87 if aa>=4:88 a6=" xxx"89 if aa>=5:90 a5=" xxx"91 if aa>=6:92 a4=" xxx"93 if aa>=7:94 a3=" xxx"95 if aa>=8:96 a2=" xxx"97 if aa>=9:98 a1=" xxx"99 ##########################################################100 if bb>=1:101 b9=" xxx"102 if bb>=2:103 b8=" xxx"104 if bb>=3:105 b7=" xxx"106 if bb>=4:107 b6=" xxx"108 if bb>=5:109 b5=" xxx"110 if bb>=6:111 b4=" xxx"112 if bb>=7:113 b3=" xxx"114 if bb>=8:115 b2=" xxx"116 if bb>=9:117 b1=" xxx"118 ##########################################################119 if cc>=1:120 c9=" xxx"121 if cc>=2:122 c8=" xxx"123 if cc>=3:124 c7=" xxx"125 if cc>=4:126 c6=" xxx"127 if cc>=5:128 c5=" xxx"129 if cc>=6:130 c4=" xxx"131 if cc>=7:132 c3=" xxx"133 if cc>=8:134 c2=" xxx"135 if cc>=9:136 c1=" xxx"137 ##########################################################138 if dd>=1:139 d9=" xxx"140 if dd>=2:141 d8=" xxx"142 if dd>=3:143 d7=" xxx"144 if dd>=4:145 d6=" xxx"146 if dd>=5:147 d5=" xxx"148 if dd>=6:149 d4=" xxx"150 if dd>=7:151 d3=" xxx"152 if dd>=8:153 d2=" xxx"154 if dd>=9:155 d1=" xxx"156 ##########################################################157 if ee>=1:158 e9=" xxx"159 if ee>=2:160 e8=" xxx"161 if ee>=3:162 e7=" xxx"163 if ee>=4:164 e6=" xxx"165 if ee>=5:166 e5=" xxx"167 if ee>=6:168 e4=" xxx"169 if ee>=7:170 e3=" xxx"171 if ee>=8:172 e2=" xxx"173 if ee>=9:174 e1=" xxx"175 ##########################################################176 if ff>=1:177 f9=" xxx"178 if ff>=2:179 f8=" xxx"180 if ff>=3:181 f7=" xxx"182 if ff>=4:183 f6=" xxx"184 if ff>=5:185 f5=" xxx"186 if ff>=6:187 f4=" xxx"188 if ff>=7:189 f3=" xxx"190 if ff>=8:191 f2=" xxx"192 if ff>=9:193 f1=" xxx"194 ####################################################### 195 # Agregar valores bajo el abaco 196 z1,z2,z3,z4,z5,z6=" "," "," "," "," "," "197 if a9==" xxx":198 z1=int(100000)199 if b9==" xxx":200 z2=int(10000)201 if c9==" xxx":202 z3=int(1000)203 #204 if d9==" xxx":205 z4=int(100)206 #207 if e9==" xxx":208 z5=int(10)209 #210 if f9==" xxx":211 z6=int(1)212 print(" ",a," ", b," ",c," ",d," ",e," ",f)213 print(" ",a1," ",b1," ",c1," ",d1," ",e1," ",f1)214 print(" ",a2," ",b2," ",c2," ",d2," ",e2," ",f2)215 print(" ",a3," ",b3," ",c3," ",d3," ",e3," ",f3)216 print(" ",a4," ",b4," ",c4," ",d4," ",e4," ",f4)217 print(" ",a5," ",b5," ",c5," ",d5," ",e5," ",f5)218 print(" ",a6," ",b6," ",c6," ",d6," ",e6," ",f6)219 print(" ",a7," ",b7," ",c7," ",d7," ",e7," ",f7)220 print(" ",a8," ",b8," ",c8," ",d8," ",e8," ",f8)221 print(" ",a9," ",b9," ",c9," ",d9," ",e9," ",f9)222 print(" ",z1," ",z2," ",z3," ",z4," ",z5," ",z6)223 224 if z==6:225 imprimir(int(Asx[0]),int(Asx[1]),int(Asx[2]),int(Asx[3]),int(Asx[4]),int(Asx[5]))226 elif z>6: #Valor mal ingresado mas de 6 digitos227 print("Valor mal ingresado")228 else: #agregar ceros229 z=6-z230 #print(z)231 Asx.reverse()232 for i in range(z):233 Asx.append(0)234 Asx.reverse()235 print(Asx)236 imprimir(int(Asx[0]),int(Asx[1]),int(Asx[2]),int(Asx[3]),int(Asx[4]),int(Asx[5]))237 lista.append(a) #agrega al final de la lista el valor de variable a238 pregunta_final=str(input("¿Continuar con el programa? si o no. : "))239 if pregunta_final=="no": #termino de bucle e imprimir la lista de valores ingresados240 print("Historial de ingresos:")241 #n=1242 for i in lista:243 i=int(i)244 J= locale.format_string('%.f', i, grouping=True, monetary=True)245 print(J)246 break247 else:...

Full Screen

Full Screen

extflow_extract_files_from_tcpflow.py

Source:extflow_extract_files_from_tcpflow.py Github

copy

Full Screen

1import os2# extflow.py created by Alexander.Hanel@gmail.com3# This is a simple script that will carve out files4# from streams created by tcpflow. See 5# Stolen from http://hooked-on-mnemonics.blogspot.com/2012/04/extflowpy-hack-for-carving-files-from.html67def ext(header):8 # To add a new signature add your own elif statement9 # elif 'FILE SIGNATURE' in header:10 # return 'FILE EXTENSION'11 12 if 'MZ' in header:13 return '.mz'14 elif 'FWS' in header:15 return '.swf'16 elif 'CWS' in header:17 return '.swf'18 elif 'html' in header:19 return '.html'20 elif '\x50\x4B\x03\x04\x14\x00\x08\x00\x08' in header:21 return '.jar'22 elif 'PK' in header:23 return '.zip'24 elif 'PDF' in header:25 return '.pdf'26 else:27 return '.bin'28 return 2930def main():31 for infile in os.listdir(os.getcwd()):32 if '.py' in infile or 'pcap' in infile :33 continue34 f = open(infile, 'rb')35 d = f.read()36 addr = d.find('\x0d\x0a\x0d\x0a') + 437 if addr == len(d):38 continue39 f.seek(addr)40 # if the file signature is farther than the first 20 bytes41 # you should change the read value to that distance 42 o = open(infile+ext(f.read(20)), 'wb')43 f.seek(addr)44 o.write(f.read())45 o.close()46 47if __name__ == '__main__':48 main()4950"""51remnux@remnux:~/Desktop/tmp$ ls52dump.pcap extflow.py53remnux@remnux:~/Desktop/tmp$ tcpflow -r dump.pcap 54remnux@remnux:~/Desktop/tmp$ ls55010.000.002.015.01052-XXX.XXX.XXX.XXX.00080 XXX.XXX.XXX.XXX.00080-010.000.002.015.0105456010.000.002.015.01053-XXX.XXX.XXX.XXX.00080 XXX.XXX.XXX.XXX.00080-010.000.002.015.0105557010.000.002.015.01054-XXX.XXX.XXX.XXX.00080 XXX.XXX.XXX.XXX.00080-010.000.002.015.0105658010.000.002.015.01055-XXX.XXX.XXX.XXX.00080 XXX.XXX.XXX.XXX.00080-010.000.002.015.0105759010.000.002.015.01056-XXX.XXX.XXX.XXX.00080 XXX.XXX.XXX.XXX.00080-010.000.002.015.0105860010.000.002.015.01057-XXX.XXX.XXX.XXX.00080 XXX.XXX.XXX.XXX.00080-010.000.002.015.0106061010.000.002.015.01058-XXX.XXX.XXX.XXX.00080 XXX.XXX.XXX.XXX.00080-010.000.002.015.0106262010.000.002.015.01060-XXX.XXX.XXX.XXX.00080 XXX.XXX.XXX.XXX.00080-010.000.002.015.0105263010.000.002.015.01062-XXX.XXX.XXX.XXX.00080 dump.pcap64XXX.XXX.XXX.XXX.00080-010.000.002.015.01053 extflow.py65remnux@remnux:~/Desktop/tmp$ python ./extflow.py 66remnux@remnux:~/Desktop/tmp$ ls67010.000.002.015.01052-XXX.XXX.XXX.XXX.00080 XXX.XXX.XXX.XXX.00080-010.000.002.015.01055.swf68010.000.002.015.01053-XXX.XXX.XXX.XXX.00080 XXX.XXX.XXX.XXX.00080-010.000.002.015.0105669010.000.002.015.01054-XXX.XXX.XXX.XXX.00080 XXX.XXX.XXX.XXX.00080-010.000.002.015.01056.jar70010.000.002.015.01055-XXX.XXX.XXX.XXX.00080 XXX.XXX.XXX.XXX.00080-010.000.002.015.0105771010.000.002.015.01056-XXX.XXX.XXX.XXX.00080 XXX.XXX.XXX.XXX.00080-010.000.002.015.01057.mz72010.000.002.015.01057-XXX.XXX.XXX.XXX.00080 XXX.XXX.XXX.XXX.00080-010.000.002.015.0105873010.000.002.015.01058-XXX.XXX.XXX.XXX.00080 XXX.XXX.XXX.XXX.00080-010.000.002.015.01058.mz74010.000.002.015.01060-XXX.XXX.XXX.XXX.00080 XXX.XXX.XXX.XXX.00080-010.000.002.015.0106075010.000.002.015.01060-XXX.XXX.XXX.XXX.00080.bin XXX.XXX.XXX.XXX.00080-010.000.002.015.01060.bin76010.000.002.015.01062-XXX.XXX.XXX.XXX.00080 XXX.XXX.XXX.XXX.00080-010.000.002.015.0106277010.000.002.015.01062-XXX.XXX.XXX.XXX.00080.bin XXX.XXX.XXX.XXX.00080-010.000.002.015.01062.bin78XXX.XXX.XXX.XXX.00080-010.000.002.015.01053 XXX.XXX.XXX.XXX.00080-010.000.002.015.0105279XXX.XXX.XXX.XXX.00080-010.000.002.015.01053.html XXX.XXX.XXX.XXX.00080-010.000.002.015.01052.html80XXX.XXX.XXX.XXX.00080-010.000.002.015.01054 dump.pcap81XXX.XXX.XXX.XXX.00080-010.000.002.015.01054.pdf extflow.py82XXX.XXX.XXX.XXX.00080-010.000.002.015.01055 ...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful