Skip to content

Instantly share code, notes, and snippets.

@0asys
0asys / inject_so.py
Created June 30, 2020 10:49
inject_so.py
import ctypes
import sys
import os
class user_regs_struct(ctypes.Structure):
_fields_ = [
("r15", ctypes.c_ulonglong),
("r14", ctypes.c_ulonglong),
("r13", ctypes.c_ulonglong),
("r12", ctypes.c_ulonglong),
@0asys
0asys / remote-user-ldap-backend.py
Created February 15, 2019 07:14
RemoteUserLdapBackend: Combine the RemoteUser Authentication and the django-auth-ldap to populate Users in Django
"""
Combine the RemoteUser Authentication and the django-auth-ldap
to populate Users in Django
https://docs.djangoproject.com/en/2.1/howto/auth-remote-user/
https://django-auth-ldap.readthedocs.io/en/latest/
"""
import logging
from django.contrib.auth import load_backend, login
@0asys
0asys / drf-rules-permission-class-with-httpmethod-map.py
Last active November 28, 2019 09:19
Django Restframework Rules Permission integration with HTTPMethod Map
"""
Django REST Framework Permission Class for Django Rules
"""
from rest_framework import permissions, exceptions
from rest_framework.viewsets import ModelViewSet
from django.http import Http404
class DjangoRulesMethodObjectPermissions(permissions.BasePermission):
"""