Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
B

ÂÐýÆH£sã@sädZddlmZddlmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlmZddlmZmZmZddlmmZddlmZmZmZddlmZdd	lmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%e&ej'j(j)ƒa*d
diZ+dd
ddddddgZ,dd„Z-e.ƒe/ƒdfdd„Z0dd„Z1e-dƒZ2e-dƒZ3dd„Z4d<dd „Z5d=d!d"„Z6d>d#d$„Z7d?d%d&„Z8d@d(d)„Z9d*d+„Z:dAd.d/„Z;dBd0d1„Z<dCd2d3„Z=dDd4d5„Z>dEd7d8„Z?dddej@fd9d:„ZAeBd;kràeAƒdS)Fz&
Main module for interactive startup.
é)Úabsolute_import)Úprint_functionN)Úchoice)Úlog_interactiveÚlog_loadingÚScapy_Exception)ÚDefaultThemeÚ
BlackAndWhiteÚapply_ipython_style)ÚWINDOWS)ÚcastÚAnyÚDictÚListÚOptionalÚTupleÚUnionZtlsztls.all)z0Craft packets like it is your last day on earth.zLao-Tze)z#Craft packets like I craft my beer.zJean De Clerck)z$Craft packets before they craft you.ZSocrate)zCraft me if you can.z
IPv6 layer)z`To craft a packet, you have to be a packet, and learn how to swim in the wires and in the waves.zJean-Claude Van Damme)z,We are in France, we say Skappee. OK? Merci.zSebastien Chabal)z'Wanna support scapy? Star us on GitHub!zSatoshi Nakamoto)zWhat is dead may never die!zPython 2cCsBtj tj d¡|¡}yt |¡Wntk
r8dSX|SdS)Nú~)ÚosÚpathÚjoinÚ
expanduserÚstatÚOSError)ÚcfZcf_path©rúŒ/build/wlanpi-profiler-CSvHZ8/wlanpi-profiler-1.0.7~rc2/debian/wlanpi-profiler/opt/wlanpi-profiler/lib/python3.7/site-packages/scapy/main.pyÚ_probe_config_fileBsrTc
Csœt d|¡y0t|ƒ}tt| ¡|dƒ||ƒWdQRXWnZtk
rr}z|rT‚t d||¡Wdd}~XYn&tk
r–|r†‚t 	d|¡YnXdS)a®Read a config file: execute a python file while loading scapy, that
    may contain some pre-configured values.

    If _globals or _locals are specified, they will be updated with
    the loaded vars.  This allows an external program to use the
    function. Otherwise, vars are only available from inside the scapy
    console.

    params:
    - _globals: the globals() vars
    - _locals: the locals() vars
    - interactive: specified whether or not errors should be printed
    using the scapy console or raised.

    ex, content of a config.py file:
        'conf.verb = 42
'
    Manual loading:
        >>> _read_config_file("./config.py"))
        >>> conf.verb
        2

    zLoading config file [%s]ÚexecNz!Cannot read config file [%s] [%s]z+Error during evaluation of config file [%s])
rÚdebugÚopenrÚcompileÚreadÚIOErrorÚwarningÚ	ExceptionÚ	exception)rZ_globalsZ_localsÚinteractiveZcfgfÚerrrÚ_read_config_fileMs
r)cCs|ddko|tkS)zªReturns whether or not a variable should be imported.
    Will return False for any default modules (sys), or if
    they are detected as private vars (starting with a _)rÚ_)ÚIGNORED)ÚxrrrÚ_validate_localxsr-z.scapy_prestart.pyz.scapy_startup.pycCstdƒt d¡dS)NzºUsage: scapy.py [-s sessionfile] [-c new_startup_file] [-p new_prestart_file] [-C] [-P] [-H]
Args:
	-H: header-less start
	-C: do not read startup file
	-P: do not read pre-startup file
r)ÚprintÚsysÚexitrrrrÚ_usage…sr1cCsÆ|dkrtjjj}yŠt |¡}d|jkr^xp|jdD]$}|dk	rJ| |¡|j|||<q4Wn<x:t |j¡D]*\}}t|ƒrl|dk	rŽ| |¡|||<qlWWn$t	k
rÀt
jd|ddYnXdS)z¿Loads a Python module to make variables, objects and functions
available globally.

    The idea is to load the module using importlib, then copy the
symbols to the global symbol table.

    NÚ__all__zLoading module %sT)Úexc_info)ÚsixÚmovesÚbuiltinsÚ__dict__Ú	importlibÚ
import_moduleÚappendÚ	iteritemsr-r%rÚerror)ÚmoduleÚglobals_dictÚ	symb_listÚmodÚnameÚsymrrrÚ_load—s 	




rCcCstd|||ddS)z[Loads a Scapy module to make variables, objects and functions
    available globally.

    zscapy.modules.)r>r?N)rC)rAr>r?rrrÚload_moduleµsrDcCstdt ||¡||ddS)zaLoads a Scapy layer module to make variables, objects and functions
    available globally.

    z
scapy.layers.)r>r?N)rCÚ
LAYER_ALIASESÚget)rAr>r?rrrÚ
load_layer¿srGcCsxy$t d|¡td|||dWnNtk
rr}z0yt|||dWntk
r`|‚YnXWdd}~XYnXdS)zñLoads a Scapy contrib module to make variables, objects and
    functions available globally.

    If no contrib module can be found with the given name, try to find
    a layer module, since a contrib module may become a layer module.

    zscapy.contrib.)r>r?N)r8r9rCÚImportErrorrG)rAr>r?r(rrrÚload_contribÉs	rIFc
Cs|dkrd}n"d|kr0d|kr0| d¡s0|d7}g}tj tj t¡d¡}tjdkrttj |d|¡}tj	|d	d
}ntj ||¡}t 	|¡}x@|D]6}| 
tjjd¡ d¡d
}| 
d¡rÀq”| d¡rÖ|dd…}dd|dœ}tj|dd¤}	xœ|	D]”}
|
ddkrqø|
 d¡}|dkr`|d7}|
 d|¡}|
||… ¡}
|
|dd… ¡}|||
<|ddkrpP|drø|drø| |¡PqøWWdQRX|r”|ddkr®q”|drÀ|ds”td|ƒ‚q”W|jdd„d |rê|Sx|D]}td!|ƒqðWdSdS)"zûShow the list of all existing contribs.

    :param name: filter to search the contribs
    :param ret: whether the function should return a dict instead of
        printing it
    :returns: None or a dictionary containing the results if ret=True
    Nz*.pyÚ*ú?z.pyÚcontrib)ééz**T)Ú	recursiveÚ.zcontrib.éÚ__éýÿÿÿÚ)ÚdescriptionÚstatusrAÚreplace)Úerrorsrú#zscapy.contrib.éú=érVÚskiprUz(Module %s is missing its contrib infos !cSs|dS)NrAr)r,rrrÚ<lambda>ózlist_contrib.<locals>.<lambda>)Úkeyz1%(name)-20s: %(description)-40s status=%(status)s)ÚendswithrrrÚdirnameÚ__file__r/Úversion_infoÚglobÚiglobrWÚsepÚ	partitionÚ
startswithÚior ÚfindÚstripr:rÚsortr.)rAÚretÚ_debugÚresultsZdir_pathÚiteratorÚfr@ÚdescÚfdÚlineÚpÚqr`ÚvaluerrrÚlist_contribßs\








rycCs8yddlm}|ƒj |¡Wntk
r2YnXdS)z)Updates IPython session with a custom oner)Úget_ipythonN)ÚIPythonrzÚuser_nsÚupdater%)ÚsessionrzrrrÚupdate_ipython_session(s
rrTéÿÿÿÿcCs’ddlm}ddlm}m}|s<|j}|s<|jdd|_}t d|¡|sˆyddl	m
}|ƒj}Wn"tk
r†t
jjjd}YnXttttf|ƒ ¡}d	|kr¬|d	=xŽt|ƒD]‚}||}	t|	d
ƒrê|ddksä|	j d¡rê||=t|	|ƒrü||=q¶t|	tttjfƒr¶|ddkr2t d
|t||ƒ¡||=q¶Wyt  ||d¡Wnt!k
rfYnXt" #|d¡}
t
jj$ %||
|¡|
 &¡dS)aSave current Scapy session to the file specified in the fname arg.

    params:
     - fname: file to save the scapy session in
     - session: scapy session to use. If None, the console one will be used
     - pickleProto: pickle proto version (default: -1 = latest)r)Úutils)ÚconfÚ	ConfClassT)ZkeepzUse [%s] as session file)rzÚ
scapy_sessionÚ__builtins__Ú
__module__r*r{z[%s] (%s) can't be saved.z.bakÚwbN)'ÚscapyrÚscapy.configr‚rƒr~Z
get_temp_filerÚinfor{rzr|r%r4r5r6r7rrÚstrr
ÚcopyÚlistÚhasattrr†riÚ
isinstanceÚtypeÚtypesÚ
ModuleTyper<rÚrenamerÚgzipr ÚcPickleÚdumpÚclose)Úfnamer~ZpickleProtorr‚rƒrzZto_be_savedÚkÚirrrrrÚsave_session2sF

r›cCs²ddlm}|dkr|j}ytjj t |d¡¡}WnDt	k
rxytjj t|dƒ¡}Wnt	k
rr‚YnXYnXtjj
jd}| ¡| 
|¡t|ƒt d|¡dS)z­Load current Scapy session from the file specified in the fname arg.
    This will erase any existing session.

    params:
     - fname: file to load the scapy session fromr)r‚NÚrbr„zLoaded session [%s])r‰r‚r~r4r5r•Úloadr”r r#r6r7Úclearr}rrrŠ)r˜r‚Úsr„rrrÚload_sessionds
r cCs‚ddlm}|dkr|j}ytjj t |d¡¡}Wn(t	k
r\tjj t|dƒ¡}YnXtjj
jd}| |¡t
|ƒdS)z…Update current Scapy session from the file specified in the fname arg.

    params:
     - fname: file to load the scapy session fromr)r‚Nrœr„)r‰r‚r~r4r5r•rr”r r#r6r7r}r)r˜r‚rŸr„rrrÚupdate_sessions
r¡cCsÜddlm}i}g}dd„t t dd¡j¡Dƒ}tjjj 	|¡| 
|¡| d¡|rŽyt 
|¡Wn tk
rŠt d|¡Yn¾XyTytjj t |d	¡¡}Wn(tk
rÐtjj t|d	ƒ¡}YnXt d
|¡Wnftk
rd}t ||¡YnBtk
r&t d|¡Yn"tk
rFt d
|¡YnX|r~d|krv| |d¡||_||d<n||_n||_d|i}nd|i}|tjjjd<|dk	rÔtjjjd 	|¡t|ƒ| 
|¡||fS)Nr)r‚cSsi|]\}}t|ƒr||“qSr)r-)Ú.0r™Úvrrrú
<dictcomp>™sz init_session.<locals>.<dictcomp>z.allrˆr„zNew session [%s]rœzUsing session [%s]z5Error opening Python3 pickled session on Python2 [%s]zError opening session [%s]z-Error opening session [%s]. Attribute missingr‚)r‰r‚r4r;r8r9r7r5r6r}Úextendr:rrrrrŠr•rr”r r#Ú
ValueErrorr<ÚEOFErrorÚAttributeErrorÚ	configurer~r)Úsession_nameÚmydictr‚ÚSESSIONÚGLOBKEYSZscapy_builtinsÚmsgrrrÚinit_session‘sX






r¯éNcCs¸| d¡}|d8}g}g}dd„}xR|rt|rH||ƒt|dƒd|krZ| | d¡¡q$| dd |¡¡g}q$W|r’| dd |¡¡g}| dd|t|ƒd	|f¡|S)
zhThis function processes a quote and returns a string that is ready
to be used in the fancy prompt.

    ú écSstdd„|Dƒƒt|ƒdS)Ncss|]}t|ƒVqdS)N)Úlen)r¢Úeltrrrú	<genexpr>ßsz/_prepare_quote.<locals>._len.<locals>.<genexpr>r\)Úsumr³)rurrrÚ_lenÝsz_prepare_quote.<locals>._lenrr\z   | %sz   | %s-- %srN)Úsplitr³r:Úpopr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Python not available. Using standard Python shell instead.
AutoCompletion, History are disabled.z$On Windows, colors are also disabled)Úget_terminal_widthéTéKz&                                      z&                     aSPY//YASa       z&             apyyyyCY//////////YCa    z&            sY//////YSpcs  scpCY//Pp  z& ayp ayyyyyyySCP//Pp           syY//C z& AYAsAYYYYYYYY///Ps              cY//Sz&         pCCCCY//p          cSSps y//Yz&         SPPPP///a          pP///AC//Yz&              A//A            cyP////Cz&              p///Ac            sC///az&              P////YCpc           A//Az&       scccccp///pSP///p          p//Yz&      sY/////////y  caa           S//Pz&       cayCyayP//Ya              pY/Yaz&        sY/PsY////YCc          aC//Yp z&         sc  sccaCY//PCypaapyCP//YSs  z&                  spCPY//////YPSps    z&                       ccaacs         z      .SYPACCCSASYY  zP /SCS/CCS        ACSz       /A          ACz     A/PS       /SPPSz        YP        (SCz       SPS/A.      SCz   Y/PACC          PPz    PY*AYC        CAAz         YYCY//SCYP  rTz   |z   | Welcome to Scapyz   | Version %sz$   | https://github.com/secdev/scapyz   | Have fun!cSsg|]}|dd…‘qS)rQNr)r¢r,rrrú
<listcomp>yszinteract.<locals>.<listcomp>rMr€é')r¼Ú
css|]\}}||VqdS)Nr)r¢ÚlogoÚbannerrrrrµ€szinteract.<locals>.<genexpr>c3s|]}ˆj |¡VqdS)N)Úcolor_themerË)r¢ru)r‚rrrµsc3s|]}ˆj |¡VqdS)N)rÍÚsuccess)r¢ru)r‚rrrµ‚s)Ú	fillvaluezWelcome to Scapy (%s)z using IPython %s
)ÚConfigzFtraitlets not available. Some Scapy shell features won't be available.z	print("""z"""))Zdisplay_bannerr|Z
exec_lines)rÌÚlocal)rz)Úshellr²z	Scapy v%s)Úconfigr|)IÚwarningsÚsimplefilterr‰r‚r'rrÍZlogLevelÚDEFAULT_STARTUP_FILEÚDEFAULT_PRESTART_FILEr/ÚargvÚgetoptr1Zfancy_promptÚverbÚloggingÚWARNINGÚmaxr³ÚGetoptErrorrrr<r0r¯r)Zinteractive_shellÚlowerr{rÄrHr$rr	Zscapy.utilsrÅÚversionrÚQUOTESr¥rÀr:r4r5Úzip_longestÚ__version__Ztraitlets.config.loaderrÐr%ÚcodeÚinteractrzr
ZTerminalInteractiveShellZconfirm_exitZseparate_inÚintZterm_title_formatZ	CompleterZuse_jediZ
term_titleZhistfileZHistoryAccessorZ	hist_fileZInteractiveShellZbanner1r¨Ú	TypeErrorr~r›r6r7)r«rØZmybannerZloglevelZSTARTUP_FILEZ
PRESTART_FILErªÚoptsÚoptÚparamr®r¬r­r{rÄZIPYTHONrÅZmini_bannerZthe_logoZ
the_logo_miniZ
the_bannerrºr»Zbanner_textrÌrÐÚcfgrzr™r)r‚rråís:









råÚ__main__)NN)NN)NN)NN)NFF)rTNr€)N)N)N)r°)CÚ__doc__Ú
__future__rrr/rrÙrär”rer8rjrÛr‘rÔÚrandomrZscapy.errorrrrZscapy.modules.sixÚmodulesr4Zscapy.themesrr	r
Zscapy.constsrZscapy.compatrr
rrrrrrr5r6r7r+rErárÚglobalsÚlocalsr)r-r×rÖr1rCrDrGrIryrr›r r¡r¯rÀÚINFOråÚ__name__rrrrÚ<module>sj$
*	






G

2


@
Z