The swidGenerator Tool » History » Version 6
Version 5 (Andreas Steffen, 10.04.2014 15:26) → Version 6/17 (Andreas Steffen, 10.04.2014 15:46)
h1. The swidGenerator Tool
{{>toc}}
"swidGenerator":https://github.com/tnc-ba/swidGenerator is an open source python-based tool written by the HSR students Danilo Bargen, Christian Fässler and Jonas Furrer which is able to generate ISO/IEC 1977-2-2014 Software Identification (SWID) tags for all installed software packages installed by the Linux *dpkg* and *yum* packet managers.
h2. Installation
h3. Download
Next download the latest swidGenerator tarball from https://github.com/tnc-ba/swidGenerator/archive/master.zip and unpack the archive with the command
<pre>
unzip swidGenerator-master.zip
</pre>
h3. Required Packages under Debian or Ubuntu
Make sure that the *python* and *python-setuptools* are present on your system. Otherwise install them with
<pre>
sudo apt-get install python python-setuptools
</pre>
h3. Required Packages under Fedora or RedHat Enterprise Linux
h3. Installation
You are going to need *yum-utils"
<pre>
sudo yum install yum-utils
</pre>
Change into the unpacked archive and execute the command
<pre>
sudo python setup.py install
</pre>
and the *swid_generator* function usually installed in */usr/local/bin* becomes available.
h2. Usage
h3. Generate Software IDs
The command
<pre>
swid_generator software-id
</pre>
creates a list of Unique Software Identifications of the form
<pre>
regid.2004-03.org.strongswan_debian_7.4-x86_64-acpi-support-base-0.140-5
regid.2004-03.org.strongswan_debian_7.4-x86_64-acpid-1:2.0.16-1+deb7u1
regid.2004-03.org.strongswan_debian_7.4-x86_64-adduser-3.113+nmu3
regid.2004-03.org.strongswan_debian_7.4-x86_64-apache2-2.2.22-13+deb7u1
...
regid.2004-03.org.strongswan_debian_7.4-x86_64-xz-utils-5.1.1alpha+20120614-2
regid.2004-03.org.strongswan_debian_7.4-x86_64-zlib1g-1:1.2.7.dfsg-13
regid.2004-03.org.strongswan_debian_7.4-x86_64-zlib1g-dev-1:1.2.7.dfsg-13
</pre>
By default the *regid.2004-03.org.strongswan* regid is used as the tagcreator.
With the *--regid <tagcreator>* option an arbitrary regid can be configured
<pre>
swid_generator software-id --regid regid.1999-03.org.debian
</pre>
which generates the list
<pre>
regid.1999-03.org.debian_debian_7.4-x86_64-acpi-support-base-0.140-5
regid.1999-03.org.debian_debian_7.4-x86_64-acpid-1:2.0.16-1+deb7u1
...
regid.1999-03.org.debian_debian_7.4-x86_64-zlib1g-1:1.2.7.dfsg-13
regid.1999-03.org.debian_debian_7.4-x86_64-zlib1g-dev-1:1.2.7.dfsg-13
</pre>
The *--doc-separator* option allows to define a single character or a character string separating the individual Software IDs.
* swid_generator software-id --doc-separator '@'
<pre>regid.2004-03.org.strongswan_debian_7.4-x86_64-acpi-support-base-0.140-5@regid.2004-03.org.strongswan_debian_7.4-x86_64-acpid-1:2.0.16-1+deb7u1@...</pre>
* swid_generator software-id --doc-separator '::'
<pre>regid.2004-03.org.strongswan_debian_7.4-x86_64-acpi-support-base-0.140-5::regid.2004-03.org.strongswan_debian_7.4-x86_64-acpid-1:2.0.16-1+deb7u1::...</pre>
* swid_generator software-id --doc-separator $'\n'
<pre>
regid.2004-03.org.strongswan_debian_7.4-x86_64-acpi-support-base-0.140-5
regid.2004-03.org.strongswan_debian_7.4-x86_64-acpid-1:2.0.16-1+deb7u1
...
</pre>
* swid_generator software-id --doc-separator $'\n\n' (which is currently the default)
<pre>
regid.2004-03.org.strongswan_debian_7.4-x86_64-acpi-support-base-0.140-5
regid.2004-03.org.strongswan_debian_7.4-x86_64-acpid-1:2.0.16-1+deb7u1
...
</pre>
h3 Generate SWID Tags
The simple command
<pre>
swid_generator swid
</pre>
generates SWID tags for all installed packages
<pre>
<?xml version='1.0' encoding='UTF-8'?><SoftwareIdentity name="account-plugin-aim" uniqueId="Ubuntu_13.10-x86_64-account-plugin-aim-3.8.4-1ubuntu2" version="3.8.4-1ubuntu2" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd"><Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator" /></SoftwareIdentity>
<?xml version='1.0' encoding='UTF-8'?><SoftwareIdentity name="account-plugin-facebook" uniqueId="Ubuntu_13.10-x86_64-account-plugin-facebook-0.11+13.10.20130802-0ubuntu1" version="0.11+13.10.20130802-0ubuntu1" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd"><Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator" /></SoftwareIdentity>
...
<?xml version='1.0' encoding='UTF-8'?><SoftwareIdentity name="zlib1g" uniqueId="Ubuntu_13.10-x86_64-zlib1g-1:1.2.8.dfsg-1ubuntu1" version="1:1.2.8.dfsg-1ubuntu1" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd"><Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator" /></SoftwareIdentity>
<?xml version='1.0' encoding='UTF-8'?><SoftwareIdentity name="zlib1g-dev" uniqueId="Ubuntu_13.10-x86_64-zlib1g-dev-1:1.2.8.dfsg-1ubuntu1" version="1:1.2.8.dfsg-1ubuntu1" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd"><Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator" /></SoftwareIdentity>
</pre>
or with
<pre>
swid_generator swid --doc-separator $'\n'
</pre>
the even more compact form
<pre>
<?xml version='1.0' encoding='UTF-8'?><SoftwareIdentity name="account-plugin-aim" uniqueId="Ubuntu_13.10-x86_64-account-plugin-aim-3.8.4-1ubuntu2" version="3.8.4-1ubuntu2" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd"><Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator" /></SoftwareIdentity>
<?xml version='1.0' encoding='UTF-8'?><SoftwareIdentity name="account-plugin-facebook" uniqueId="Ubuntu_13.10-x86_64-account-plugin-facebook-0.11+13.10.20130802-0ubuntu1" version="0.11+13.10.20130802-0ubuntu1" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd"><Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator" /></SoftwareIdentity>
...
<?xml version='1.0' encoding='UTF-8'?><SoftwareIdentity name="zlib1g" uniqueId="Ubuntu_13.10-x86_64-zlib1g-1:1.2.8.dfsg-1ubuntu1" version="1:1.2.8.dfsg-1ubuntu1" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd"><Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator" /></SoftwareIdentity>
<?xml version='1.0' encoding='UTF-8'?><SoftwareIdentity name="zlib1g-dev" uniqueId="Ubuntu_13.10-x86_64-zlib1g-dev-1:1.2.8.dfsg-1ubuntu1" version="1:1.2.8.dfsg-1ubuntu1" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd"><Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator" /></SoftwareIdentity>
</pre>
Manual inspection of the SWID tags is facilitated by using the pretty print option
<pre>
swid_generator swid --pretty
</pre>
which generates
<pre>
<?xml version="1.0" encoding="UTF-8"?>
<SoftwareIdentity name="account-plugin-aim" uniqueId="Ubuntu_13.10-x86_64-account-plugin-aim-3.8.4-1ubuntu2" version="3.8.4-1ubuntu2" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd">
<Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator"/>
</SoftwareIdentity>
<?xml version="1.0" encoding="UTF-8"?>
<SoftwareIdentity name="account-plugin-facebook" uniqueId="Ubuntu_13.10-x86_64-account-plugin-facebook-0.11+13.10.20130802-0ubuntu1" version="0.11+13.10.20130802-0ubuntu1" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd">
<Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator"/>
</SoftwareIdentity>
...
<?xml version="1.0" encoding="UTF-8"?>
<SoftwareIdentity name="zlib1g" uniqueId="Ubuntu_13.10-x86_64-zlib1g-1:1.2.8.dfsg-1ubuntu1" version="1:1.2.8.dfsg-1ubuntu1" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd">
<Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator"/>
</SoftwareIdentity>
<?xml version="1.0" encoding="UTF-8"?>
<SoftwareIdentity name="zlib1g-dev" uniqueId="Ubuntu_13.10-x86_64-zlib1g-dev-1:1.2.8.dfsg-1ubuntu1" version="1:1.2.8.dfsg-1ubuntu1" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd">
<Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator"/>
</SoftwareIdentity>
</pre>
{{>toc}}
"swidGenerator":https://github.com/tnc-ba/swidGenerator is an open source python-based tool written by the HSR students Danilo Bargen, Christian Fässler and Jonas Furrer which is able to generate ISO/IEC 1977-2-2014 Software Identification (SWID) tags for all installed software packages installed by the Linux *dpkg* and *yum* packet managers.
h2. Installation
h3. Download
Next download the latest swidGenerator tarball from https://github.com/tnc-ba/swidGenerator/archive/master.zip and unpack the archive with the command
<pre>
unzip swidGenerator-master.zip
</pre>
h3. Required Packages under Debian or Ubuntu
Make sure that the *python* and *python-setuptools* are present on your system. Otherwise install them with
<pre>
sudo apt-get install python python-setuptools
</pre>
h3. Required Packages under Fedora or RedHat Enterprise Linux
h3. Installation
You are going to need *yum-utils"
<pre>
sudo yum install yum-utils
</pre>
Change into the unpacked archive and execute the command
<pre>
sudo python setup.py install
</pre>
and the *swid_generator* function usually installed in */usr/local/bin* becomes available.
h2. Usage
h3. Generate Software IDs
The command
<pre>
swid_generator software-id
</pre>
creates a list of Unique Software Identifications of the form
<pre>
regid.2004-03.org.strongswan_debian_7.4-x86_64-acpi-support-base-0.140-5
regid.2004-03.org.strongswan_debian_7.4-x86_64-acpid-1:2.0.16-1+deb7u1
regid.2004-03.org.strongswan_debian_7.4-x86_64-adduser-3.113+nmu3
regid.2004-03.org.strongswan_debian_7.4-x86_64-apache2-2.2.22-13+deb7u1
...
regid.2004-03.org.strongswan_debian_7.4-x86_64-xz-utils-5.1.1alpha+20120614-2
regid.2004-03.org.strongswan_debian_7.4-x86_64-zlib1g-1:1.2.7.dfsg-13
regid.2004-03.org.strongswan_debian_7.4-x86_64-zlib1g-dev-1:1.2.7.dfsg-13
</pre>
By default the *regid.2004-03.org.strongswan* regid is used as the tagcreator.
With the *--regid <tagcreator>* option an arbitrary regid can be configured
<pre>
swid_generator software-id --regid regid.1999-03.org.debian
</pre>
which generates the list
<pre>
regid.1999-03.org.debian_debian_7.4-x86_64-acpi-support-base-0.140-5
regid.1999-03.org.debian_debian_7.4-x86_64-acpid-1:2.0.16-1+deb7u1
...
regid.1999-03.org.debian_debian_7.4-x86_64-zlib1g-1:1.2.7.dfsg-13
regid.1999-03.org.debian_debian_7.4-x86_64-zlib1g-dev-1:1.2.7.dfsg-13
</pre>
The *--doc-separator* option allows to define a single character or a character string separating the individual Software IDs.
* swid_generator software-id --doc-separator '@'
<pre>regid.2004-03.org.strongswan_debian_7.4-x86_64-acpi-support-base-0.140-5@regid.2004-03.org.strongswan_debian_7.4-x86_64-acpid-1:2.0.16-1+deb7u1@...</pre>
* swid_generator software-id --doc-separator '::'
<pre>regid.2004-03.org.strongswan_debian_7.4-x86_64-acpi-support-base-0.140-5::regid.2004-03.org.strongswan_debian_7.4-x86_64-acpid-1:2.0.16-1+deb7u1::...</pre>
* swid_generator software-id --doc-separator $'\n'
<pre>
regid.2004-03.org.strongswan_debian_7.4-x86_64-acpi-support-base-0.140-5
regid.2004-03.org.strongswan_debian_7.4-x86_64-acpid-1:2.0.16-1+deb7u1
...
</pre>
* swid_generator software-id --doc-separator $'\n\n' (which is currently the default)
<pre>
regid.2004-03.org.strongswan_debian_7.4-x86_64-acpi-support-base-0.140-5
regid.2004-03.org.strongswan_debian_7.4-x86_64-acpid-1:2.0.16-1+deb7u1
...
</pre>
h3 Generate SWID Tags
The simple command
<pre>
swid_generator swid
</pre>
generates SWID tags for all installed packages
<pre>
<?xml version='1.0' encoding='UTF-8'?><SoftwareIdentity name="account-plugin-aim" uniqueId="Ubuntu_13.10-x86_64-account-plugin-aim-3.8.4-1ubuntu2" version="3.8.4-1ubuntu2" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd"><Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator" /></SoftwareIdentity>
<?xml version='1.0' encoding='UTF-8'?><SoftwareIdentity name="account-plugin-facebook" uniqueId="Ubuntu_13.10-x86_64-account-plugin-facebook-0.11+13.10.20130802-0ubuntu1" version="0.11+13.10.20130802-0ubuntu1" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd"><Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator" /></SoftwareIdentity>
...
<?xml version='1.0' encoding='UTF-8'?><SoftwareIdentity name="zlib1g" uniqueId="Ubuntu_13.10-x86_64-zlib1g-1:1.2.8.dfsg-1ubuntu1" version="1:1.2.8.dfsg-1ubuntu1" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd"><Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator" /></SoftwareIdentity>
<?xml version='1.0' encoding='UTF-8'?><SoftwareIdentity name="zlib1g-dev" uniqueId="Ubuntu_13.10-x86_64-zlib1g-dev-1:1.2.8.dfsg-1ubuntu1" version="1:1.2.8.dfsg-1ubuntu1" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd"><Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator" /></SoftwareIdentity>
</pre>
or with
<pre>
swid_generator swid --doc-separator $'\n'
</pre>
the even more compact form
<pre>
<?xml version='1.0' encoding='UTF-8'?><SoftwareIdentity name="account-plugin-aim" uniqueId="Ubuntu_13.10-x86_64-account-plugin-aim-3.8.4-1ubuntu2" version="3.8.4-1ubuntu2" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd"><Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator" /></SoftwareIdentity>
<?xml version='1.0' encoding='UTF-8'?><SoftwareIdentity name="account-plugin-facebook" uniqueId="Ubuntu_13.10-x86_64-account-plugin-facebook-0.11+13.10.20130802-0ubuntu1" version="0.11+13.10.20130802-0ubuntu1" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd"><Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator" /></SoftwareIdentity>
...
<?xml version='1.0' encoding='UTF-8'?><SoftwareIdentity name="zlib1g" uniqueId="Ubuntu_13.10-x86_64-zlib1g-1:1.2.8.dfsg-1ubuntu1" version="1:1.2.8.dfsg-1ubuntu1" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd"><Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator" /></SoftwareIdentity>
<?xml version='1.0' encoding='UTF-8'?><SoftwareIdentity name="zlib1g-dev" uniqueId="Ubuntu_13.10-x86_64-zlib1g-dev-1:1.2.8.dfsg-1ubuntu1" version="1:1.2.8.dfsg-1ubuntu1" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd"><Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator" /></SoftwareIdentity>
</pre>
Manual inspection of the SWID tags is facilitated by using the pretty print option
<pre>
swid_generator swid --pretty
</pre>
which generates
<pre>
<?xml version="1.0" encoding="UTF-8"?>
<SoftwareIdentity name="account-plugin-aim" uniqueId="Ubuntu_13.10-x86_64-account-plugin-aim-3.8.4-1ubuntu2" version="3.8.4-1ubuntu2" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd">
<Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator"/>
</SoftwareIdentity>
<?xml version="1.0" encoding="UTF-8"?>
<SoftwareIdentity name="account-plugin-facebook" uniqueId="Ubuntu_13.10-x86_64-account-plugin-facebook-0.11+13.10.20130802-0ubuntu1" version="0.11+13.10.20130802-0ubuntu1" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd">
<Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator"/>
</SoftwareIdentity>
...
<?xml version="1.0" encoding="UTF-8"?>
<SoftwareIdentity name="zlib1g" uniqueId="Ubuntu_13.10-x86_64-zlib1g-1:1.2.8.dfsg-1ubuntu1" version="1:1.2.8.dfsg-1ubuntu1" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd">
<Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator"/>
</SoftwareIdentity>
<?xml version="1.0" encoding="UTF-8"?>
<SoftwareIdentity name="zlib1g-dev" uniqueId="Ubuntu_13.10-x86_64-zlib1g-dev-1:1.2.8.dfsg-1ubuntu1" version="1:1.2.8.dfsg-1ubuntu1" versionScheme="alphanumeric" xmlns="http://standards.iso.org/iso/19770/-2/2014/schema.xsd">
<Entity name="strongSwan" regid="regid.2004-03.org.strongswan" role="tagcreator"/>
</SoftwareIdentity>
</pre>