pkg module¶
Some console-friendly methods are exposed in pkg.*, and defined at pkg.commands.
-
pkg.commands.install(spec, repo=None, upgrade=False)¶ Download and install a package from specified repository. See
install_from_repo().Parameters:
-
pkg.commands.remove(name)¶ Remove a package locally (LocalPackage.remove).
-
pkg.commands.local(name)¶ Find an installed package (LocalPackage.by_name).
Returns: None if package is not found, else LocalPackage instance. Return type: LocalPackage
-
pkg.commands.remote(name, repo=None)¶ Find a remote package from given repos.
Parameters: Returns: None if package is not found, else InstallablePackage instance.
Return type:
-
pkg.commands.refresh()¶ Rescan and load available plugins.
-
pkg.commands.upgrade(spec, repo=None)¶ Upgrade specified package. (
pkg.install(spec, repo, upgrade=True))Parameters: - spec (str) – name==version, or just name only.
- repo – target repository to download.
pkg.package: Package-related classes¶
Package-related classes and methods are in pkg.package module. All constructing arguments are accessible via property.
-
class
pkg.package.LocalPackage(id, path, version)¶ Bases:
object-
static
all(disabled=False)¶ List all packages installed at
g['path']['packages'].Return type: list(LocalPackage)
-
static
by_name(name, prefix=None)¶ Returns a package with specified name.
Return type: LocalPackage
-
install(remove_on_fail=False)¶ Run python scripts specified by
installersfield in info.json.Returns: None
-
load(force=False)¶ Actually does
ida_loaders.load_plugin(paths), and updates IDAUSR variable.
-
loaders()¶
-
plugins()¶
-
populate_env()¶ A passive version of load; it only populates IDAUSR variable. It’s called at
idapythonrc.py.
-
procs()¶
-
remove()¶ Removes a package.
-
static
pkg.repo: Repository information¶
-
class
pkg.repo.GitHubRepository(repo, timeout=8)¶ Bases:
pkg.repo.RepositoryGitHub-hosted repository. https://github.com/Jinmo/idapkg-repo
-
get(name)¶ Fetch metadata for single package from the repo.
Returns: None if package is not found, else a InstallablePackageobjectReturn type: pkg.package.InstallablePackage or None
-
list()¶ Fetch a list of all packages in the repo.
Returns: list of InstallablePackage in the repo. Return type: list(pkg.package.InstallablePackage)
-
releases(name)¶ Fetch a list of releases of specified package.
-
-
class
pkg.repo.OldRepository(url, timeout=8)¶ Bases:
pkg.repo.RepositoryS3-hosted repository. https://github.com/Jinmo/idapkg-api
-
get(name)¶ Fetch metadata for single package from the repo.
Returns: None if package is not found, else a InstallablePackageobjectReturn type: pkg.package.InstallablePackage or None
-
list()¶ Fetch a list of all packages in the repo.
Returns: list of InstallablePackage in the repo. Return type: list(pkg.package.InstallablePackage)
-
releases(name)¶ Fetch a list of releases of specified package.
-
-
class
pkg.repo.Repository¶ Bases:
objectAn instance of this class represents a single repository.
-
get(name)¶ Fetch metadata for single package from the repo.
Returns: None if package is not found, else a InstallablePackageobjectReturn type: pkg.package.InstallablePackage or None
-
list()¶ Fetch a list of all packages in the repo.
Returns: list of InstallablePackage in the repo. Return type: list(pkg.package.InstallablePackage)
-
releases(name)¶ Fetch a list of releases of specified package.
-
-
pkg.repo.get_online_packages(repos=None)¶ Generates a list of packages from specified repositories.
Parameters: repos (list(str) or None) – Array of repository urls (string). Default: g[‘repos’] Returns: list( InstallablePackage) from each repos.
pkg.config: config.json as g objects¶
This module generates and manages config data. Initial config is like this:
__initial_config = {
'path': {
'virtualenv': idapkg_dir('python'),
'packages': idapkg_dir('packages')
},
'repos': [
'https://api.idapkg.com'
],
'idausr_native_bases': [None, None]
}
| g: | Config object extended from __initial_config.
Loaded from and saved to ~/idapkg/config.json.
g['path']['packages'] == idapkg_dir('python') initially. |
|---|
pkg.env: IDA version, and EA¶
| os: | operating system. ‘win’ | ‘mac’ | ‘linux’ |
|---|---|
| ea: | current ea. 32 | 64 |
| version: | Decimal object for IDA Pro’s version (ex. Decimal(6.95)) |
| version_info: | namedtuple with version details
(ex. VersionPair(major=7, minor=0, micro=171130)) |