Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/apport/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/apport/__pycache__/hookutils.cpython-310.pyc
o

�v�fh��@shdZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlmZddlZddlZe�d�Zdadd�Zdkd	d
�Zdldd�Zdkd
d�Zdmdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z dd�Z!dd�Z"dd �Z#dej$ddfd!d"�Z%d#d$�Z&d%d&�Z'd'd(�Z(dej$dfd)d*�Z)d+d,�Z*d-d.�Z+dnd/d0�Z,dnd1d2�Z-d3Z.d4Z/d5Z0d6Z1d7Z2d8Z3d9Z4d:Z5d;Z6d<Z7d=Z8d>Z9d?d@�Z:dAdB�Z;dndCdD�Z<dEdF�Z=dGdH�Z>dIdJ�Z?dodpdLdM�Z@dNdO�ZAdPdQ�ZBdRdS�ZCdndTdU�ZDdVdW�ZEdXdY�ZFdZd[�ZGd\d]�ZHdqd_d`�ZIdadb�ZJdcdd�ZKdedf�ZLdndgdh�ZMdidj�ZNejOjPZPejOjQZQdS)rz/Convenience functions for use in package hooks.�N)�implz[^0-9a-zA-Z_.-]cCsLtjddkrt|t�r|�d�}n
t|t�s|�d�}t�d|�dd��S)z{Generate a valid report key name from a file path.

    This will replace invalid punctuation symbols with valid ones.
    r�3�UTF-8�.� �_)	�sys�version�
isinstance�bytes�decode�encode�_invalid_key_chars_re�sub�replace)�path�r�2/usr/lib/python3/dist-packages/apport/hookutils.py�path_to_key's

�

rTFcCs<d|vrdS|st|�}tj�|�rt|||||�dSdS)a�Attach file contents if file exists.

    If key is not specified, the key name will be derived from the file
    name with path_to_key().

    If overwrite is True, an existing key will be updated. If it is False, a
    new key with '_' appended will be added instead.

    If the contents is valid UTF-8, or force_unicode is True, then the value
    will be a string, otherwise it will be bytes.
    �../N)r�osr�exists�attach_file��reportr�key�	overwrite�
force_unicoderrr�attach_file_if_exists5s�rc
Cs,z}d|vrWdSt�|tjtjBtjB�}t�|�}tj�|�}|jt�	|�jks-||kr5t�
|�WdSt	�|j�rXt�
|d��}|����}Wd�n1sRwYnt�
|�WdS|rj|jddd	�WSz|�d�WWSty}|YWSwty�}zd
t|�WYd}~Sd}~ww)aReturn the contents of the specified path.

    If the contents is valid UTF-8, or force_unicode is True, then the value
    will a string, otherwise it will be bytes.

    Upon error, this will deliver a text representation of the error,
    instead of failing.
    rzError: invalid path.zError: path contained symlinks.�rbNz#Error: path was not a regular file.rr��errors�Error: )r�open�
O_NOFOLLOW�O_RDONLY�
O_NONBLOCK�fstatr�realpath�st_ino�stat�close�S_ISREG�st_mode�fdopen�read�stripr�UnicodeDecodeError�	Exception�str)rr�fd�st�	real_path�f�contents�errr�	read_fileMs6	

��

���r:cCs<|st|�}|s||vr|d7}||vst||d�||<dS)a�Attach a file to the report.

    If key is not specified, the key name will be derived from the file
    name with path_to_key().

    If overwrite is True, an existing key will be updated. If it is False, a
    new key with '_' appended will be added instead.

    If the contents is valid UTF-8, or force_unicode is True, then the value
    will a string, otherwise it will be bytes.
    r)rN)rr:rrrrrrs�rc
Cs�t�|�}|��D]R\}}|r||vrq	dt|�}t|�tkr.|dks)|�d�r.|||<q	|rC|�d|�}|r>|||<n	d||<nd||<tj�	t
�|�j�}	|	�
�|dt|�<q	dS)a(Attach information about any modified or deleted conffiles.

    If conffiles is given, only this subset will be attached. If ui is given,
    ask whether the contents of the file may be added to the report; if this is
    denied, or there is no UI, just mark it as "modified" in the report.
    zmodified.conffile.z	[deleted]z
[inaccessibleznIt seems you have modified the contents of "%s".  Would you like to add the contents of it to your bug report?z
[modified]zmtime.conffile.N)�	packaging�get_modified_conffiles�itemsr�typer3�
startswith�yesno�datetime�
fromtimestamprr*�st_mtime�	isoformat)
r�package�	conffiles�ui�modifiedrr8r�response�mtimerrr�attach_conffiles�s"


�rKcCsrztj�|�}Wn
tyYdSw|D]!}tj�|�r6|�d�r6|�dd�}d|�dd�}t	|||�qdS)z3Attach information about any Upstart override filesNz
/etc/init/�.confz	.override�upstart.�)
�apportr;�	get_files�
ValueErrorrrrr?rr)rrE�files�file�overriderrrr�attach_upstart_overrides�s���rUcCs|ztj�|�}Wn
tyYdSw|D]�}tj�|�sq|�d�rgtj�|��	dd�}d|}z
tj�
tjdd|�}Wn"ty`ztj�
tjdd	d|�}Wn
ty]YYqwYnwt
|||�|�d
�r�|�d�r�tj�tj�|��d}d
|}d|}z
tj�
tjdd|�}Wn"ty�ztj�
tjdd	d|�}Wn
ty�YYqwYnwt
|||�qdS)z9Attach information about a package's session upstart logsNz/usr/share/upstart/sessions/rLz.logrM�XDG_CACHE_HOME�upstart�HOMEz.cachez/usr/share/applications/z.desktoprzupstart.application.zapplication-%s.log)rOr;rPrQrrrr?�basenamer�join�environ�KeyErrorr�endswith�splitext)rrErRr7�logr�desktopnamerrr�attach_upstart_logs�sN�
��������racCs&|�dd���stdg�|d<dSdS)zwAttach information from the kernel ring buffer (dmesg).

    This will not overwrite already existing information.
    �CurrentDmesgrN�dmesgN)�getr0�root_command_output�rrrr�attach_dmesg�s�rgc
Cs�d}tj�|�rPt�|�D]D}tj�d||f�}t�|�}t�|j�r+|jd@dkr,q
|dvr1q
zt|�}Wnt	t
fyBYq
w|rO||d|�dd�<q
dSdS)	Nz/sys/class/dmi/idz%s/%s�r)�	subsystem�ueventzdmi.rr)rr�isdir�listdirr(r*r,r-r:�OSError�IOErrorr)r�dmi_dirr7�pr5�valuerrr�
attach_dmi�s&
���rrcCs�t|�t|dd�t|dd�t|dd�tj�d�r,tdd	g�|d
<tddg�|d<td
g�|d<td
dg�|d<td
dg�|d<tddg�|d<tgd��|d<tdg�|d<|d}t�dd|�}t�dd|�}t�dd|�}t�dd|�}t�dd|�}t�dd|�}||d<t	|�d |vr�d!|vr�d"|d |d!f|d#<t
d$�r�td$g�|d%<t
d&�r�td&d'g���}|r�||d(<td&d)g���}|r�||d*<d+Sd+Sd+S),a~Attach a standard set of hardware-related data to the report, including:

    - kernel dmesg (boot and current)
    - /proc/interrupts
    - /proc/cpuinfo
    - /proc/cmdline
    - /proc/modules
    - lspci -vvnn
    - lscpi -vt
    - lsusb
    - lsusb -v
    - lsusb -t
    - devices from udev
    - DMI information from /sys
    - prtconf (sparc)
    - pccardctl status/ident
    z/proc/interrupts�ProcInterrupts�
/proc/cpuinfo�ProcCpuinfo�
/proc/cmdline�ProcKernelCmdLinez/sys/bus/pci�lspci�-vvnn�Lspciz-vtzLspci-vt�lsusb�Lsusb�-vzLsusb-vz-tzLsusb-t�sort�
/proc/modules�ProcModules)�udevadm�infoz--export-db�UdevDbz%/usr/share/apport/dump_acpi_tables.py�acpidumpzID_FS_LABEL=(.*)zID_FS_LABEL=<hidden>zID_FS_LABEL_ENC=(.*)zID_FS_LABEL_ENC=<hidden>z
by-label/(.*)zby-label/<hidden>zdmi.sys.vendorzdmi.product.namez%s %s�MachineType�prtconf�Prtconf�	pccardctl�status�PccardctlStatus�ident�PccardctlIdentN)rgrrrr�command_outputre�rerrr�command_availabler0)r�labels�outrrr�attach_hardware�sL�
��r�cCs�t|tj�d�d�t|tj�d�d�t|d�t|dd�t|dd	�tgd
��|d<tdd
g�|d<tdd
g�|d<tt�|d<g}tj�d�rwt	d�� }|D]}d|vrg|�
���}|�t
|d��qRWd�n1srwY|D]s}d|}tddt|�dg�||<d|}tddt|�g�||<t�d|�D]J}tj�|�r�tj�|�}d|t|�f}t|||d�q�tj�|�r�tj�|�}t�|�D]}	tj�||	�}
d|t|�t|	�f}t||
|�q�q�qydS)z� (loosely based on http://www.alsa-project.org/alsa-info.sh)
    for systems where alsa-info is not installed (i e, *buntu 12.04 and earlier)
    z~/.asoundrc�UserAsoundrcz~/.asoundrc.asoundconf�UserAsoundrcAsoundconfz/etc/asound.confz/proc/asound/version�AlsaVersionrtru)�ls�-lz	/dev/snd/�AlsaDevices�aplayr��AplayDevices�arecord�ArecordDevices�
PciMultimediaz/proc/asound/cardsz]:rNzCard%d.Amixer.info�amixerz-cr�zCard%d.Amixer.valuesz/proc/asound/card%d/codec*zCard%d.Codecs.%s�rzCard%d.Codecs.%s.%s)rrr�
expanduserrr��pci_devices�PCI_MULTIMEDIArr#�lstrip�split�append�intr3�glob�isfilerYrrkrlrZ)r�cardsr4�line�fields�cardr�	codecpath�codec�namerrrr�attach_alsa_old:sT��

������r�cCs�tj�d�rtgd��|d<ntj�d�rtgd��|d<nt|�tddgt�d�t�d	�t�d
��|d<tj�d�rGtd
dg�|d<tj�d�rTtdg�|d<t|�t|�dS)z5Attach ALSA subsystem information to the report.
    �/usr/sbin/alsa-info)r��--stdout�--no-upload�AlsaInfo�!/usr/share/alsa-base/alsa-info.sh)r�r�r��fuserr}z	/dev/dsp*z
/dev/snd/*z	/dev/seq*�AudioDevicesInUsez/usr/bin/pacmd�pacmd�list�	PulseListz/usr/bin/pa-info�PaInfoN)rrrr�r�r�rrrgrfrrr�attach_alsags$�r�cCsbdtjvrdStjd}|�tj�D]}|sqtj�||�}tj�|�r.t�|tj�r.dSqdS)z/Is given command on the executable search path?�PATHFT)	rr[r��pathseprrZr��access�X_OK)�commandr�element�filenamerrrr�~s

�r�c

Cs�tj��}|sd|d<ztj|tj||rtjpd|d�}Wnty5}zdt|�WYd}~Sd}~ww|�|�d}|j	dkrG|�
�}	ndt|���dt|j	���d	|}	|re|	jd
dd�}	|	S)
a;Try to execute given command (list) and return its stdout.

    In case of failure, a textual error gets returned. This function forces
    LC_MESSAGES to C, to avoid translated output in bug reports.

    If decode_utf8 is True (default), the output will be converted to a string,
    otherwise left as bytes.
    �C�LC_MESSAGESN)�stdout�stderr�stdin�envr"rsError: command s failed with exit code s: rrr )
rr[�copy�
subprocess�Popen�PIPErmr3�communicate�
returncoder0r
r)
r��inputr��keep_locale�decode_utf8r��spr9r��resrrrr��s4



���

���r�cCs�tdurdSt��dkrdStj��sdStj�d�sdSz	t�d�\}}Wn
t	y0YdSwt
jddt|�dgdt
j
t
j
d�at�|�t���(}	|�|tj�|��}|D]\}}|tj@rqt�|�Wd�dSqZqM1svwYdS)Nrz/usr/bin/pkttyagent�
pkttyagentz--notify-fdz
--fallbackF)�	close_fdsr�r�)�_AGENTr�geteuidrr��isattyrr�pipe2rmr�r�r3r�r+�select�epoll�register�EPOLLIN�poll�EPOLLHUP)�r�wr��eventsr4�
event_typerrr�_spawn_pkttyagent�s@
��



���r�cCs$tdurdSt��t��dadS�N)r��	terminate�waitrrrr�kill_pkttyagent�s
r�cCs,t��dkrgStj�d�rt�dgSgS)Nrz/usr/bin/pkexec�pkexec)r�getuidrrr�rrrr�_root_command_prefix�sr�cCs.t|t�s	Jd��tt�|||d|d�}|S)a=Try to execute given command (list) as root and return its stdout.

    This passes the command through pkexec, unless the caller is already root.

    In case of failure, a textual error gets returned.

    If decode_utf8 is True (default), the output will be converted to a string,
    otherwise left as bytes.
    zcommand must be a listT)r�r�)r
r�r�r�)r�r�r�r��outputrrrre�s

�rec	CsZtj�tj�tj�dd��d�}t��}z�tj�|d�}t|d�}|�	�D]\}}t
|d�s2Jd��|�d|tj�||�f�q%|��t
�t�||g�}|��|D]I}z"ttj�||�d	��}	|	����}
Wd
�n1sswYWn	ty�YqUwz|
�d�}
Wn	ty�Ynw|
r�|
||<|	��qUWt�|�d
St�|�w)a*Execute multiple commands as root and put their outputs into report.

    command_map is a keyname -> 'shell command' dictionary with the commands to
    run. They are all run through /bin/sh, so you need to take care of shell
    escaping yourself. To include stderr output of a command, end it with
    "2>&1".

    Just like root_command_output, this passes the command through pkexec,
    unless the caller is already root.

    This is preferrable to using root_command_output() multiple times, as that
    will ask for the password every time.
    �APPORT_DATA_DIRz/usr/share/apport�root_info_wrapperz:script:r�r0z(command must be a string (shell command)z%s | cat > %s
rNr)rrrZ�abspathr[rd�tempfile�mkdtempr#r=�hasattr�writer+r�r�r�r�r/r0rnrr1�shutil�rmtree)r�command_map�wrapper_path�workdir�script_path�script�keynamer�r�r7�bufrrr�attach_root_command_outputs�sD��
����
�r�cCsld}|��dur$|jD]}|jddd�}|�|�r||7}q|��dus|j��|��|jdkr4|SdS)NrNrrr r)r�r�r�searchr+r�r�)�pattern�process�linesr�rrr�__filter_re_process+s

��

rcCsl|rtjddd|gtjd�}n"tj�d�r tjgd�tjd�}nt�dtj�r1tjgd�tjd�}t||�S)	z�Extract recent system messages which match a regex.

    pattern should be a "re" object. By default, messages are read from
    the systemd journal, or /var/log/syslog; but when giving "path", messages
    are read from there instead.
    �tail�-n�10000�r��/run/systemd/system)�
journalctlz--systemz--quiet�-bz-a�/var/log/syslog)rrrr)	r�r�r�rrrr��R_OKr)rrrprrr�
recent_syslog9s�
�
�
r
cCs�tj�d�}tj�|�rt�|tj�sdS|st�d�}d}t|d��}|D]}|j	ddd�}|�
|�r8||7}q&Wd�|S1sDwY|S)	alExtract messages from ~/.xsession-errors.

    By default this parses out glib-style warnings, errors, criticals etc. and
    X window errors.  You can specify a "re" object as pattern to customize the
    filtering.

    Please note that you should avoid attaching the whole file to reports, as
    it can, and often does, contain sensitive and private data.
    z~/.xsession-errorsrNz�^(\(.*:\d+\): \w+-(WARNING|CRITICAL|ERROR))|(Error: .*No Symbols named)|([^ ]+\[\d+\]: ([A-Z]+):)|([^ ]-[A-Z]+ \*\*:)|(received an X Window System error)|(^The error was \')|(^  \(Details: serial \d+ error_code)rrrr N)rrr�rr�rr��compiler#rr�)rrrr7r�rrr�xsession_errorsLs&
�

��
��r���rh�����	�
��c

Gs�|stddg�Sd}tddg�}|�d�D]]}d}d}|�d�D]8}z
|�dd	�\}}Wn	ty5Yq w|��}|��}|d
krRt|dd�d
�}	|	d@d?}q |dkrX|}q |rr|rr||vrr|rg|d7}|tdd|g���7}q|S)z9Return a text dump of PCI devices attached to the system.rxryrNz-vvmmnnz

N�
�:r�Class�������i�r�Slotz-vvnns)r�r�rQr0r�)
�pci_classes�resultr��	paragraph�	pci_class�slotr�rrq�nrrrr�us6���r�cCstddg�S)z9Return a text dump of USB devices attached to the system.r{r})r�rrrr�usb_devices�sr(cs,t�|�}�r�fdd�|D�}|S|}|S)zFRetrieve a list of files owned by package, optionally matching globpatcsg|]}tj�|��r|�qSr)r��fnmatch)�.0r7��globpatrr�
<listcomp>�sz$files_in_package.<locals>.<listcomp>)r;rP)rEr,rRr#rr+r�files_in_package�s
�r.cCsdS)�ObsoleteNr)rrErrr�attach_gconf�sr0c
	Cs&|�dd�}i}tj��}d|d<tjdd|g|tjd�}|jD]#}z|�dd	�\}}}	|	�	�}	Wn	t
y:Yq w|	|�|i�|<q tjdd|gtjd
�}|jD]:}z|�dd	�\}}}	|	�	�}	Wn	t
ylYqRw|	|�|i��|d�kr�|dkr�|dvr�d
}	|d|||	f7}qR||d<dS)z0Attach user-modified gsettings keys of a schema.�GsettingsChangesrNz/nonexisting�XDG_CONFIG_HOME�	gsettingszlist-recursively)r�r�Nrrsorg.gnome.shell)scommand-historys
favorite-appszredacted by apportz	%s %s %s
)rdrr[r�r�r�r�r�r��rstriprQ�
setdefault)
r�schema�	cur_value�defaultsr�r3r��schema_namerrqrrr�attach_gsettings_schema�s@
�
��
��r:cCs2t|d�D]}tj�|�dd�}t||�qdS)z@Attach user-modified gsettings keys of all schemas in a package.z)/usr/share/glib-2.0/schemas/*.gschema.xmlNi�)r.rrrYr:)rrE�schema_filer6rrr�attach_gsettings_package�s�r<�returncCsbtj�d�sdS|��}|r!||}||}d|��d|��g}nddg}tddg|�|d	<dS)
z�Attach journal warnings and errors.

    If the report contains a date, get the journal logs around that
    date (plus/minus the time_window in seconds). Otherwise attach the
    latest 1000 journal logs since the last boot.
    rNz	--since=@z	--until=@r
z--lines=1000r	z--priority=warning�
JournalErrors)rrr�
get_timestampr�)r�time_window�crash_timestamp�before_crash�after_crash�argsrrr�attach_journal_errors�s
�rEcCs`tddg�|d<tddg�|d<tt�|d<t|ddd	�d
D]}|tjvr-tj|||<qdS)z5Attach generic network-related information to report.�ip�route�IpRoute�addr�IpAddr�
PciNetworkz/etc/network/interfaces�IfupdownConfigr�)�
http_proxy�	ftp_proxy�no_proxyN)r�r��PCI_NETWORKrrr[)r�varrrr�attach_network�s
��rRcCs�tt�d��|d<t�ddt�ddt�ddtd	g����|d
<tddg�|d
<tj�d�r4tgd��}nd}||d<t|ddd�dS)z5Attach wireless (WiFi) network information to report.zH(NetworkManager|modem-manager|dhclient|kernel|wpa_supplicant)(\[\d+\])?:�
WifiSyslogz
ESSID:(.*)zESSID:<hidden>zEncryption key:(.*)zEncryption key: <hidden>zAccess Point: (.*)zAccess Point: <hidden>�iwconfig�IwConfig�rfkillr��RfKillz/sbin/iw)�iw�regrd�N/A�CRDAz/var/log/wpa_supplicant.log�WpaSupplicantLogr�N)	r
r�rrr�rrrr)r�	iw_outputrrr�attach_wifi�s���r^cCsvt|dd�t|dd�tdg�|d<tddg�|d	<t�d
�}|r3tgd�|�}t�dd
|�|d<td�|d<dS)zkAttach printing information to the report.

    Based on http://wiki.ubuntu.com/PrintingBugInfoScript.
    z/etc/papersize�	Papersizez/var/log/cups/error_log�CupsErrorLog�locale�Locale�lpstatr}�Lpstatz/etc/cups/ppd/*.ppd)�fgrepz-Hz	*NickNamez*/etc/cups/ppd/(.*).ppd:\*NickName: *"(.*)"z\g<1>: \g<2>�PpdFiles) �foo2zjszfoomatic-dbzfoomatic-db-engine�foomatic-db-gutenprintzfoomatic-db-hpijszfoomatic-filterszfoomatic-gui�hpijs�hplip�m2300w�min12xxw�c2050�hpoj�pxljr�pnm2ppa�splixzhp-ppdz
hpijs-ppdszlinuxprinting.org-ppdszopenprinting-ppdszopenprinting-ppds-extra�ghostscript�cupszcups-driver-gutenprintrh�
ijsgutenprintzcupsys-driver-gutenprintzgimp-gutenprintzgutenprint-doczgutenprint-localeszsystem-config-printer-common�kdeprint�PrintingPackagesN)rr�r�r�r�package_versions)r�ppds�	nicknamesrrr�attach_printings
rzc		Csht|t�r|g}d}t�|tj�}d}t�|tj�}d|vr,d�t�|tdg���|d<d|vrAtj	�
d�rAt|dd|d	i�t|d
d�t
|dd
�t�||�dd�|�dd��D]T}|sit|d�dSz(|ddkrw|dd�}ntjddkr�t�|�jddd�}n|jddd�}Wn	ty�Yq]w|D]}t�d|d|�r�t|d�nq�q]dS)z0Attach MAC information and events to the report.z!audit\(|apparmor|selinux|securityz'apparmor="DENIED".+?profile=([^ ]+?)[ ]�KernLogrrc�AuditLogz/var/run/auditd.pidzegrep "z" /var/log/audit/audit.logz/proc/version_signature�ProcVersionSignaturerv�ProcCmdlinerN�apparmorr�"rrrrrr �hex�^�$N)r
r3r�r�
IGNORECASErZ�findallrerrrr�rrrd�_add_tagrr	r�fromhexrr2�match)	r�profiles�	mac_regex�mac_re�aa_regex�aa_rer��profile�search_profilerrr�attach_mac_events-sF


�$
��
���r�cCs(|�dd�}|r|d7}|||d<dS)z#Adds or appends a tag to the report�TagsrNrN)rd)r�tag�current_tagsrrrr�Xsr�cCst|�|d<dS)ziAttach version information for related packages

    In the future, this might also run their hooks.
    �RelatedPackageVersionsN)rw)r�packagesrrr�attach_related_packages`sr�c
s�|sdSg}|D]:}|s
qt�|�}|s|�|df�t|�D]"}zt�|�}Wnty3d}Ynw|dur:d}|�||f�qqttdd�t|�D��\}}d|�d�	�fdd�|D��S)	ztReturn a text listing of package names and versions.

    Arguments may be package names or globs, e. g. "foo*"
    rNrZNcSsg|]}tt|��qSr)�map�len)r*�trrrr-�sz$package_versions.<locals>.<listcomp>z
%%-%ds %%srcsg|]}�|�qSrr)r*�v��fmtrrr-�s)
r;�package_name_globr��sorted�get_versionrQr��max�ziprZ)r��versions�package_pattern�matching_packagesrEr	�
package_width�
version_widthrr�rrwhs.
��
�rwcCs�ztjd|gtjtjd�}|��d�d�}|jdkrWdSWn
ty)YdSw|��D]}|�dd�}t	|�d	kr=q.|dd
krK|d�
�Sq.dS)z-Return the license for a given kernel module.z
/sbin/modinfo)r�r�rr�invalidNrrr�license)r�r�r�r�rr�rm�
splitlinesr�r�r0)�module�modinfor�r�r�rrr�_get_module_license�s&
�
���r�rcCs�zt|��}dd�|D�}Wd�n1swYWnty(gYSwg}|D]}t|�}|rJd|vsJd|vsJd|vsJd|vsJ|�|�q-|S)zCCheck loaded modules and return a list of those which are not free.cSsg|]}|��d�qS)r)r��r*r�rrrr-�sz*nonfree_kernel_modules.<locals>.<listcomp>N�GPL�BSD�MPL�MIT)r#rnr�r�)�module_listr7�mods�nonfree�m�srrr�nonfree_kernel_modules�s
���$
�r�cCs�d}t�|�D]A}tj�||�}|dkstj�|�sqt|d�����}|dkr.|�dd�}|dkr;t	�
|�}|d7}|d	||jd
dd�f7}q|S)
NrNrjr�modes�
� �edidz-base64z%s: %s
rrr )rrlrrZr�r#r/r0r�base64�	b64encoder)�conr�r7r�valrrr�__drm_con_info�s
r�cCs`d}tj�|�s
dSt�|�D]}tj�||�}tj�tj�|d��r-t|�|dt|�<qdS)zWAdd information about DRM hardware.

    Collect information from /sys/class/drm/.
    z/sys/class/drmN�enabledzDRM.)rrrkrlrZrr�r)r�drm_dirr7r�rrr�attach_drm_info�s��r�c
Cs`tj�d�}|sItd��5}|D]!}|��}d|vr0|�d�r0d|vr0|�dd�ddd�}n
q	Wd�dSWd�n1sDwYt�tj	�}z;z0zt�
tj	d	�t�t�
|d
��}WntywYWt�
tj	|�WdSwWt�
tj	|�nt�
tj	|�wWntjy�YdSwz
t�d|�j}W||kSttfy�YdSw)z�Check if the problem happened in the currently running XDG session.

    This can be used to determine if e. g. ~/.xsession-errors is relevant and
    should be attached.

    Return None if this cannot be determined.
    �XDG_SESSION_IDz/proc/self/cgroupz
name=systemd:z.scopez	/session-rNi����r��Datez/run/systemd/sessions/)rr[rdr#r0r]r�ra�	getlocale�LC_TIME�	setlocale�time�mktime�strptimer\�Errorr*rCrnrm)r�
session_idr7r��
orig_ctime�report_time�session_start_timerrr�in_session_of_problem�sB
���
��$���r�cCspd}|st|�}tj�|�r6t|d��}dd�|��D�}d�|�||<Wd�dS1s/wYdSdS)z;attach /etc/default/grub after filtering out password linesz/etc/default/grubr�cSsg|]}|�d�s|nd�qS)�passwordz### PASSWORD LINE REMOVED ###)r?r�rrrr-s
��z'attach_default_grub.<locals>.<listcomp>rNN)rrrrr#�	readlinesrZ)rrrr7�filteredrrr�attach_default_grub�s�"��r�cCsvd}g}tj�|�r&t|dd|i�d|vr&t�|d�}|d}|d}||d<|r3d�|�|d<|�dd	�d	S)
z:attach the results of the casper md5check of install media�unknown�
CasperMD5jsonzcat '%s'r#�checksum_missmatch�CasperMD5CheckResultr�CasperMD5CheckMismatchesN)rrrr��json�loadsrZ�pop)r�locationr#�
mismatches�checkrrr�attach_casper_md5check	sr�)NTF)F)NNr�)r)r=N)r)R�__doc__r�rrr�rAr�r�r*r�r�r�r�rar��apport.packaging_implrr;rO�apport.fileutilsrrr�rrr:rrKrUrargrrr�r�r�r��STDOUTr�r�r�r�rer�rr
r�PCI_MASS_STORAGErP�PCI_DISPLAYr��
PCI_MEMORY�
PCI_BRIDGE�PCI_SIMPLE_COMMUNICATIONS�PCI_BASE_SYSTEM_PERIPHERALS�PCI_INPUT_DEVICES�PCI_DOCKING_STATIONS�PCI_PROCESSORS�PCI_SERIAL_BUSr�r(r.r0r:r<rErRr^rzr�r�r�rwr�r�r�r�r�r�r��	fileutils�shared_libraries�links_with_shared_libraryrrrr�<module>s�



%
'	@-
�!#5

!
$

+!

*

Spamworldpro Mini