Skip to content

Commit e1836e8

Browse files
committed
Inserita categoria per euristiche, inserito check per ELF header, spostate
euristiche del formato file sulla cartella corretta, inserita euristica per le risorse file PE
1 parent 73061b9 commit e1836e8

20 files changed

Lines changed: 1735 additions & 161 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@
1616
data/
1717
examples/
1818

19+
20+
dist/

.goreleaser.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This is an example .goreleaser.yml file with some sensible defaults.
2+
# Make sure to check the documentation at https://goreleaser.com
3+
before:
4+
hooks:
5+
# You may remove this if you don't use go modules.
6+
- go mod tidy
7+
# you may remove this if you don't need go generate
8+
- go generate ./...
9+
builds:
10+
- env:
11+
- CGO_ENABLED=0
12+
goos:
13+
- linux
14+
- windows
15+
- darwin
16+
ignore:
17+
- goarch: '386'
18+
archives:
19+
- replacements:
20+
darwin: Darwin
21+
linux: Linux
22+
windows: Windows
23+
386: i386
24+
amd64: x86_64
25+
checksum:
26+
name_template: 'checksums.txt'
27+
snapshot:
28+
name_template: "{{ incpatch .Version }}-next"
29+
changelog:
30+
sort: asc
31+
filters:
32+
exclude:
33+
- '^docs:'
34+
- '^test:'
35+
36+
# modelines, feel free to remove those if you don't want/use them:
37+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
38+
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
Versione 0.0.2-alpha:
2+
- Risolti fix
3+
14
Versione 0.0.1-alpha:
25
- Prima versione

analysis/strings.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,7 @@ func ExtractStrings(file *os.File, min, max int, ascii bool) []string {
4646
str = append(str, ch)
4747
}
4848
}
49+
50+
func ExtractHTTPAddress() {
51+
52+
}

formats/analysis.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type FileAnalyzed struct {
2222
}
2323

2424
type Anomaly struct {
25-
Reason string
26-
Points int
25+
Reason string // Ragione dell'anomalia
26+
Points int // Punteggio assegnato all'anomalia
27+
Type uint // Tipo di anomalia (1: difetti sul file, 2: imports/sysapi, 3: stringhe)
2728
}

formats/pe/exports.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func readExports(virtualAddress uint32) {
3030
err = binary.Read(reader, binary.LittleEndian, &exportDirectory)
3131

3232
if err != nil {
33-
fmt.Println("Impossibile leggere la struttura exportDirectory")
33+
fmt.Println("Impossibile leggere la struttura exportDirectory " + err.Error())
3434
}
3535

3636
namesTableRVA := exportDirectory.NameRva - section.VirtualAddress
@@ -47,12 +47,14 @@ func readExports(virtualAddress uint32) {
4747
_, err = reader.Seek(int64(namesTableRVA+uint32(i*4)), io.SeekStart)
4848
if err != nil {
4949
fmt.Println("Errore nel seek per la tabella delle funzioni esportate")
50+
return
5051
}
5152

5253
exportAddressTable := ExportAddressTable{}
5354
err = binary.Read(reader, binary.LittleEndian, &exportAddressTable)
5455
if err != nil {
5556
fmt.Println("Impossibile leggere la struttura ExportAddressTable per il seguente motivo : " + err.Error())
57+
return
5658
}
5759

5860
name := utils.ReadString(section.Raw[exportAddressTable.ExportRva-section.VirtualAddress:])
@@ -61,12 +63,17 @@ func readExports(virtualAddress uint32) {
6163

6264
if err != nil {
6365
fmt.Println("Impossibile eseguire il seek per la lettura della prossima riga.")
66+
return
6467
}
6568

6669
exportOrdinalTable := ExportAddressTable{}
6770
err = binary.Read(reader, binary.LittleEndian, &exportOrdinalTable)
71+
if err != nil {
72+
fmt.Println("Impossibile leggere la struttura ExportAddressTable per il seguente motivo: " + err.Error())
73+
return
74+
}
6875
rva := exportOrdinalTable.ExportRva
69-
76+
7077
export := &Export{name, ordinal + uint16(exportDirectory.OrdinalBase), rva}
7178
fileAnalyzed.Exports = append(fileAnalyzed.Exports, export)
7279
fileAnalyzed.ExportNameMap[name] = export

0 commit comments

Comments
 (0)