Showing posts with label EfiPy. Show all posts
Showing posts with label EfiPy. Show all posts

2/05/2019

Get IPv4 information via EFI_IP4_CONFIG2_PROTOCOL

This is an example to dump NIC information via UNDI.

This example code uses EFI_IP4_CONFIG2_PROTOCOL for example, only.
Here is the complete source code.

Samples code dumps these informations:
#
# Pseudo code
#
# IfInfo = Ip4Cfg2.EFI_IP4_CONFIG2_INTERFACE_INFO ()
# EFI_IP4_CONFIG2_PROTOCOL.GetData (
#                            Ip4Cfg2P,
#                            Ip4Cfg2.Ip4Config2DataTypeInterfaceInfo,
#                            e.byref (DataSize),
#                            e.cast (e.byref (IfInfo), e.PVOID)
#                            )
#
# Dumpped information
#
EFI_IP4_CONFIG2_INTERFACE_INFO.Name
EFI_IP4_CONFIG2_INTERFACE_INFO.IfType
EFI_IP4_CONFIG2_INTERFACE_INFO.HwAddressSize
EFI_IP4_CONFIG2_INTERFACE_INFO.HwAddress EFI_IP4_CONFIG2_INTERFACE_INFO.StationAddress
EFI_IP4_CONFIG2_INTERFACE_INFO.SubnetMask
EFI_IP4_CONFIG2_INTERFACE_INFO.RouteTableSize

And DNS informations:
#
# Pseudo code
#
# DnsAddr = (e.EFI_IPv4_ADDRESS * \
#            (DataSize.value / e.sizeof (e.EFI_IPv4_ADDRESS))) ()
# Status = Ip4Cfg2P[0].GetData (
#                        Ip4Cfg2P,
#                        Ip4Cfg2.Ip4Config2DataTypeDnsServer,
#                        e.byref (DataSize),
#                        e.cast (e.byref (DnsAddr), e.PVOID)
#                        )
#

# Dumpped information
#
# for Dns in DnsAddr:
#   print "   DnsAddr:"
#   for Addr in Dns.Addr:
#     print "%02X " % Addr,
#   print

8/06/2015

EfiPy initial

Source Code: https://sourceforge.net/projects/efipy/
Sampe code: https://sourceforge.net/u/efipy/svn/HEAD/tree/




Description


EfiPy is a Python Module on UEFI shell which can access UEFI BIOS kernel interface
- System Table
- Runtime Services
- Boot Services

pAnalyzer package -
Tracing UEFI protocol calling flow
Output protocol flow to screen or file with XML format

CorePy (assembly package) -
Simple Assembly code in Python environment.

EfiPy Shell package-
Simple uefi shell program coded with EfiPy library to prove EfiPy workable

EfiPy leverage these open source packages - ctypes, CorePy.
Contact:
efipy.core@gmail.com

2024/7/14 Update

Next generation EfiPy2 can be found here https://github.com/EfiPy/EfiPy2/tree/main