News for hackers. Stuff that matters.

rushter

Show HN: Hexora – detection and analysis of malicious Python scripts

https://github.com/rushter/hexora

I made a new library to detect malicious and harmful behaviour in Python scripts. It uses static analysis with semantic modeling. Even when the code is pretty obfuscated, it can still detect it.For example, it can infer that getattr(sys.modules["built"+"ins"], "".join(reversed(["al","ev"])))("1+1") Is basically: eval("1+1"). Currently, I'm testing it on public files where some of them...

( Read More... | no comments | 3 points | on HN )

Show HN: Hexora – static analysis tool for malicious Python scripts

https://github.com/rushter/hexora

I made a new library to detect malicious and harmful behaviour in Python scripts.There are alternative libraries, but they usually rely on regexes, which can be fragile and tricked. My library uses AST and tracks some of the obfuscation techniques, such as import/call reassignment.Currently, I'm testing it on public files where some of them implement malicious behavior, as well as past...

( Read More... | no comments | on HN )
Re:Ask HN: Could you share your personal blog here? on Tuesday July 04, 2023 @01:41PM (#36590023)
https://rushter.com

Most of my posts are about Python's internals and some security stuff

Re:How to track and display profile views on GitHub on Thursday July 09, 2020 @11:42AM (#23781448)
Github does not send any extra information.

    "GET /counter.svg HTTP/1.1" 200 565 "-" "github-camo (62249a1c)"

I've reverted the badge.
Re:How to track and display profile views on GitHub on Thursday July 09, 2020 @11:40AM (#23781430)
You can't view profile statistics right now. Personally, my intent was to demonstrate the concept. I don't have plans using it.
Re:How to track and display profile views on GitHub on Thursday July 09, 2020 @11:38AM (#23781409)
I've removed it because it does not display relevant information anymore (someone fetches ten times a second via wget).

I also don't have plans to use it in the future. I wanted to demonstrate the concept.

Re:How to track and display profile views on GitHub on Thursday July 09, 2020 @10:58AM (#23780990)
I agree, but I think such information should be available to all people. Some people will be doing this anyway, and they can hide this by using a transparent pixel.
Re:How to track and display profile views on GitHub on Thursday July 09, 2020 @10:56AM (#23780962)
I did some research before writing an article. GitHub started proxying images in 2014, and there are a lot of repositories that use this technique to keep their stats. I think GitHub is OK with that.
Re:Memory Management in Python on Monday August 05, 2019 @11:15AM (#20614829)
Yes, it can, by calling the free function.

Which framework do you use for deep learning? It can allocate some object on its own.

Can you give me some stats when using a model and after it's no longer in use and can't be accessible? You can get it by calling the sys._debugmallocstats() function.

Re:Memory Management in Python on Monday August 05, 2019 @01:51AM (#20611599)
Author of the article here.

I don't think system allocators are clever enough to process and allocate 100-500k of very small objects each minute when Python is performing something very intensive.

It's a pretty standard way to speedup allocation for dynamic languages. Game developers use similar techniques as well.

I have some stats on Python's allocator:

https://rushter.com/blog/python-object-allocation-statistics...

Re:Optimization tricks in Python: lists and tuples on Thursday June 14, 2018 @02:52PM (#17314324)
My article describes the tricks which are used inside the Python interpreter. Every improvement in the interpreter saves an insane amount of computing power considering its popularity.
Re:Optimization tricks in Python: lists and tuples on Thursday June 14, 2018 @01:59PM (#17313786)
Maybe I've missed something, but you can also get the same id (it's basically an address in the memory) because of the how memory allocation works. There is a special allocator in CPython, which preallocates big chunks of memory and constantly reusing it without allocation overhead. I have an article on this too.
Re:Optimization tricks in Python: lists and tuples on Thursday June 14, 2018 @09:21AM (#17311449)
Thanks, it's a typo, I was referring to the mutable object (list).