SkyStaticAnalysis
A pure-python (Python>=3.10) static analysis library providing various interfaces.
Interfaces
Clang
Clang interface included some useful functionalities. For example:
The Demo C file "hello.c":
typedef struct
{
int abc;
} StructA;
int a = 32;
int b = 444;
int c = 123;
int *p = 0;
StructA st = {0};
StructA *pst = {0};
extern int extvar = 0;
int f(int);
int use_global(int y, float z)
{
int x;
int c = *p + y;
a = 1045;
f(b);
}
int use_global_2(int y, float z)
{
int x[1900];
int q = a;
x[q];
x[a];
if (y > 100)
{
f(x[y]);
}
else
{
f(x[(int)z]);
}
}
int main()
{
StructA not_global = {0};
return 0;
}
This Python script could parse variable definitions、function parameter declarations and variable references:
c_file = os.path.join("")
root = parse_file(c_file).cursor
# extract local variables
assert {"c", "x"} == get_local_var_defs(func_decl).attributes("spelling").to_set()
# extract referenced variables
assert {"p", "y", "a", "b"} == get_var_refs(func_decl).attributes(
"spelling"
).to_set()
# extract referenced variables with functions
assert {"p", "y", "a", "b", "f"} == get_var_refs(
func_decl, include_funcs=True
).attributes("spelling").to_set()
# extract parameter variables
assert {"y", "z"} == get_param_decls(func_decl).attributes("spelling").to_set()
# extract all global values
assert {"a", "p", "b"} == get_global_ref_names(func_decl).to_set()
In-Repo Third Party Dependencies
JsonObject
As original project used Cython, it might not be compatible with platform without compilation toolchains. So I copied the source code into this project and made it runnable under pure-python.
PyC-CFG
Pyc-cfg is a pure python control flow graph builder for almost all Ansi C programming language.
As the original version only suitable for Python2, I copied its code and made it compatible for python 3.
Metadata
Release files for SkyStaticAnalysis 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| SkyStaticAnalysis-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for SkyStaticAnalysis-0.0.4-py3-none-any.whl |
Release files / SkyStaticAnalysis-0.0.4-py3-none-any.whl
| Download URL | SkyStaticAnalysis-0.0.4-py3-none-any.whl |
|---|---|
| Size | 52.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
91e6cc1016f855c882db896596b9a4afd152c3237d4ba8f9ca0d610f7b6f89d9
|
|
BLAKE2b-256 checksum How to use checksums |
2850f37cdef494e215acb5112002630b51efb3496f883fa7945d74516cab6800
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Security for SkyStaticAnalysis 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.