Skip to main content

Python Library for pyanalysis.ptsecurity.tech

PT PyAnalysis is an analytic system for AppSec processes to inspect python projects by Positive Technologies.

Installation

Install it by running

pip3 install pyanalysis

Behind the organization's proxy

pa_checker = PaClient(
    username="username", password="password", proxy="http://your-org-proxy.intranet:81"
)

Example usage

The full examples in \tests folder both for sync and async code. Use them as a reference.

from pyanalysis.client import PaClient
import os

pa_checker = PaClient(
    username=os.getenv("pa_login"), password=os.getenv("pa_password")
)

verdict = pa_checker.find_package("botcity-documents", "0.3.1")
print(verdict)
{'status': 'Suspicious',
 'why': ['checked by pyanalysis'],
 'task_id': None,
 'weights_by_versions': {'0.3.1': 250},
 'verdicts_by_versions': {'0.3.1': ['anti_analysis::Obfuscation::Packing::Generic',
   'crypto::base64',
   'host_interaction::subprocess',
   'load_code::setup_py',
   'network::Url']},
 'files': {'bac168fe9913bde36752ab4600e149fc19bb6903c2a4d9008b840d46e904cf96': {'versions': ['0.3.1'],
   'verdicts': ['load_code::setup_py', 'network::Url'],
   'weight': 30},
...,
  '4712e06e2fa77801f18c28453a710ab64e618885aad98fb488c2b80f59613636': {'versions': ['0.3.1'],
   'verdicts': ['anti_analysis::Obfuscation::Packing::Generic',
    'crypto::base64'],
   'weight': 110},
...
},
 'rules_score': {'load_code::setup_py': 10,
  'network::Url': 20,
  'host_interaction::subprocess': 10,
  'anti_analysis::Obfuscation::Packing::Generic': 100,
  'crypto::base64': 10,
  'crypto::base64 + load_code::setup_py': 100},
 'anomalies': {}}
# Fmm, file 4712e06e2fa77801f18c28453a710ab64e618885aad98fb488c2b80f59613636 is packed
print(pa_checker.kb_file_bytes("4712e06e2fa77801f18c28453a710ab64e618885aad98fb488c2b80f59613636").decode())
import zlib, base64
exec(zlib.decompress(base64.b64decode('eJytV+tzozYQ/85fQa8fA...jFhc3mH0=')))
# Do we have an unpacked version?
for child in pa_checker.kb_file_meta("4712e06e2fa77801f18c28453a710ab64e618885aad98fb488c2b80f59613636").get("data").get("children"):
    print("#", child)
    print(pa_checker.kb_file_bytes(child).decode())
# bedeb6be112de621869e30b803618a27c89e212411c7ea0222dc42d482b9206f
G=' '
D=''
from typing import List,Optional,Union
I=enumerate
E=len
F=isinstance
A=int
J=IndexError
O=list
M=min
U=str
B=None
V=bool
N=False
W=float
from botcity.document_processing.parser.entry import Entry as K
from botcity.document_processing.parser.matcher import DataTypeMatcher as P
from botcity.document_processing.geometry import Point as C,Polygon as H
def clear(HTgBY):HTgBY._entries.clear()
def Q(HTgBY):
    A=HTgBY;A._entries.sort(key=lambda e:(e.p1.y,e.p1.x))
    for (B,C) in I(A._entries):C.index=B
...

Metadata

Release files for pyanalysis 2.4.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyanalysis 2.4.5
File Size Uploaded
pyanalysis-2.4.5.tar.gz 8.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyanalysis 2.4.5
File Interpreter ABI Platform
pyanalysis-2.4.5-py3-none-any.whl Python 3 none any Details

Total release size: 20.0 kB

Release files / pyanalysis-2.4.5.tar.gz

Download URL pyanalysis-2.4.5.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7c198d5d0beca58f00b35354516510de5c7d04c35ee8e30b575d477a14d8846d
BLAKE2b-256 checksum
How to use checksums
b748fe38aa7d9ad8fb673458324b00601b172c0bef2f04f16039b5eacc2ed516
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / pyanalysis-2.4.5-py3-none-any.whl

Download URL pyanalysis-2.4.5-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a97a296e091c998b8da26bebfbda1a86cb24bed51ba4c9c0686f6faadf8f8c03
BLAKE2b-256 checksum
How to use checksums
be0668421a7c039f64c3736c6129973ec50904bc3a39c6c16c805e074308613b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

2.4.5 This release

2 release files

2.4.1

1 release file

2.4.0

1 release file

2.1.0.4

1 release file

2.1.0.2

1 release file

2.0.8.6

1 release file

2.0.4.5

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page