Skip to main content

Python Library for pyanalysis.ptsecurity.tech

Project description

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
...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyanalysis-2.4.5.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyanalysis-2.4.5-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file pyanalysis-2.4.5.tar.gz.

File metadata

  • Download URL: pyanalysis-2.4.5.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pyanalysis-2.4.5.tar.gz
Algorithm Hash digest
SHA256 7c198d5d0beca58f00b35354516510de5c7d04c35ee8e30b575d477a14d8846d
MD5 534390f1ee77fd44263aecdd88be4824
BLAKE2b-256 b748fe38aa7d9ad8fb673458324b00601b172c0bef2f04f16039b5eacc2ed516

See more details on using hashes here.

File details

Details for the file pyanalysis-2.4.5-py3-none-any.whl.

File metadata

  • Download URL: pyanalysis-2.4.5-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pyanalysis-2.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a97a296e091c998b8da26bebfbda1a86cb24bed51ba4c9c0686f6faadf8f8c03
MD5 b20349c9e5b6de81aa23441d524b7962
BLAKE2b-256 be0668421a7c039f64c3736c6129973ec50904bc3a39c6c16c805e074308613b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page