fdroidserver.scanner module#

class fdroidserver.scanner.EtipSignatureDataController#

Bases: ExodusSignatureDataController

Methods

check_last_updated()

Check if the last_updated value is ok and raise an exception if expired or inaccessible.

verify_data()

Clean and validate self.data.

check_data_version

fetch

fetch_signatures_from_web

load

load_from_cache

load_from_defaults

set_data

write_to_cache

class fdroidserver.scanner.ExitCode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: IntEnum

Attributes:
denominator

the denominator of a rational number in lowest terms

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

real

the real part of a complex number

Methods

as_integer_ratio(/)

Return a pair of integers, whose ratio is equal to the original int.

bit_count(/)

Number of ones in the binary representation of the absolute value of self.

bit_length(/)

Number of bits necessary to represent self in binary.

conjugate(/)

Returns self, the complex conjugate of any int.

from_bytes(/, bytes[, byteorder, signed])

Return the integer represented by the given array of bytes.

is_integer(/)

Returns True.

to_bytes(/[, length, byteorder, signed])

Return an array of bytes representing an integer.

NONFREE_CODE = 1#
class fdroidserver.scanner.ExodusSignatureDataController#

Bases: SignatureDataController

Methods

check_last_updated()

Check if the last_updated value is ok and raise an exception if expired or inaccessible.

verify_data()

Clean and validate self.data.

check_data_version

fetch

fetch_signatures_from_web

load

load_from_cache

load_from_defaults

set_data

write_to_cache

fetch_signatures_from_web()#
class fdroidserver.scanner.GradleVersionCatalog(catalog)#

Bases: object

Parse catalog from libs.versions.toml.

https://docs.gradle.org/current/userguide/platforms.html

Methods

alias_to_accessor(alias)

Covert alias to accessor.

bundle_to_coordinates(bundle)

Generate the Gradle dependency bundle coordinate from catalog.

get_coordinate(accessor)

Get the Gradle coordinate from the catalog with an accessor.

library_to_coordinate(library)

Generate the Gradle dependency coordinate from catalog.

plugin_to_coordinate(plugin)

Generate the Gradle plugin coordinate from catalog.

get_version

static alias_to_accessor(alias: str) str#

Covert alias to accessor.

https://docs.gradle.org/current/userguide/platforms.html#sub:mapping-aliases-to-accessors Alias is used to define a lib in catalog. Accessor is used to access it.

bundle_to_coordinates(bundle: list[str]) list[str]#

Generate the Gradle dependency bundle coordinate from catalog.

get_coordinate(accessor: str) list[str]#

Get the Gradle coordinate from the catalog with an accessor.

get_version(version: dict | str) str#
library_to_coordinate(library: dict | str) str#

Generate the Gradle dependency coordinate from catalog.

plugin_to_coordinate(plugin: dict | str) str#

Generate the Gradle plugin coordinate from catalog.

class fdroidserver.scanner.MessageStore(infos: list = <factory>, warnings: list = <factory>, errors: list = <factory>)#

Bases: object

errors: list#
infos: list#
warnings: list#
class fdroidserver.scanner.SUSSDataController#

Bases: SignatureDataController

Methods

check_last_updated()

Check if the last_updated value is ok and raise an exception if expired or inaccessible.

verify_data()

Clean and validate self.data.

check_data_version

fetch

fetch_signatures_from_web

load

load_from_cache

load_from_defaults

set_data

write_to_cache

load_from_defaults()#
class fdroidserver.scanner.ScannerTool#

Bases: object

Methods

add

compile_regexes

load

refresh

scanner_data_lookup

add(new_controller: SignatureDataController)#
compile_regexes()#
load()#
refresh()#
refresh_allowed = True#
scanner_data_lookup()#
exception fdroidserver.scanner.SignatureDataCacheMissException#

Bases: Exception

class fdroidserver.scanner.SignatureDataController(name, filename, url)#

Bases: object

Methods

check_last_updated()

Check if the last_updated value is ok and raise an exception if expired or inaccessible.

verify_data()

Clean and validate self.data.

check_data_version

fetch

fetch_signatures_from_web

load

load_from_cache

load_from_defaults

set_data

write_to_cache

check_data_version()#
check_last_updated()#

Check if the last_updated value is ok and raise an exception if expired or inaccessible.

Raises:
fetch()#
fetch_signatures_from_web()#
load()#
load_from_cache()#
load_from_defaults()#
set_data(new_data)#
verify_data()#

Clean and validate self.data.

Right now this function does just a basic key sanitation.

write_to_cache()#
exception fdroidserver.scanner.SignatureDataMalformedException#

Bases: Exception

exception fdroidserver.scanner.SignatureDataNoDefaultsException#

Bases: Exception

exception fdroidserver.scanner.SignatureDataOutdatedException#

Bases: Exception

exception fdroidserver.scanner.SignatureDataVersionMismatchException#

Bases: Exception

fdroidserver.scanner.get_catalogs(root: str) dict[str, GradleVersionCatalog]#

Get all Gradle dependency catalogs from settings.gradle[.kts].

Returns a dict with the extension and the corresponding catalog. The extension is used as the prefix of the accessor to access libs in the catalog.

fdroidserver.scanner.get_embedded_classes(apkfile, depth=0)#

Get the list of Java classes embedded into all DEX files.

Returns:

set of Java classes names as string

fdroidserver.scanner.get_gradle_compile_commands(build)#
fdroidserver.scanner.get_gradle_compile_commands_with_catalog(build, prefix)#
fdroidserver.scanner.get_gradle_compile_commands_without_catalog(build)#
fdroidserver.scanner.main()#
fdroidserver.scanner.scan_binary(apkfile, allow_debuggable=False)#

Scan output of dexdump for known non-free classes.

fdroidserver.scanner.scan_source(build_dir, build={'androidupdate': [], 'antcommands': [], 'antifeatures': {}, 'binary': None, 'build': '', 'buildjni': [], 'commit': None, 'disable': '', 'encoding': None, 'extlibs': [], 'forcevercode': False, 'forceversion': False, 'gradle': [], 'gradleprops': [], 'init': '', 'maven': None, 'ndk': None, 'novcheck': False, 'oldsdkloc': False, 'output': None, 'patch': [], 'postbuild': '', 'preassemble': [], 'prebuild': '', 'rm': [], 'scandelete': [], 'scanignore': [], 'srclibs': [], 'subdir': None, 'submodules': False, 'sudo': '', 'target': None, 'timeout': None}, json_per_build=None)#

Scan the source code in the given directory (and all subdirectories).

Returns:
the number of fatal problems encountered.