Ho scritto questo codice
Library "libc:6"
Private Const HDIO_GET_IDENTITY As Integer = &030D
' int ioctl (int __fd, unsigned long int __request, ...)
' Perform the I/O control operation specified by REQUEST on FD.
Private Extern ioctl(__fd As Integer, __request As Long, hd_drived As Pointer) As Integer
Public Sub Main()
Dim fl As File
Dim hd As Pointer
Dim err As Integer
' Elimina la protezione del file-device "/dev/sda".
' Si dovrà inserire la propria password di sistema.
Shell "echo MIA_PASSWORD | sudo -S chmod 444 /dev/sda" Wait
fl = Open "/dev/sda" For Read
hd = Alloc(SizeOf(gb.Byte), 512)
err = ioctl(fl.Handle, HDIO_GET_IDENTITY, hd)
If err < 0 Then
Free(hd)
Error.Raise("Errore alla funzione 'ioctl()' !")
Endif
Print "\n\nCilindri: "; Short@(hd + 2) & Space(16)
Print "Heads: "; Short@(hd + 6)
Print "Settori: "; Short@(hd + 12)
Print "Num. seriale: "; Trim(Left(String@(hd + 20), 20))
Print "Firmware rev.: "; Left(String@(hd + 46),
Print "Modello: "; Left(String@(hd + 54), 40)
Free(hd)
fl.Close
End
Cerca la password di root ma mi serve uno script che non cerca nessuna password