-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathssniper.h
79 lines (62 loc) · 2.22 KB
/
ssniper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
Copyright © 2007, The Board of Trustees of the University of Illinois
This file is part of SSNiper.
SSNiper is open source software, released under the University of
Illinois/NCSA Open Source License. You should have received a copy of
this license in a file with the SSNiper distribution.
*/
#ifndef SSN_WEB_H
#define SSN_WEB_H
#include "config.h"
#include <sys/types.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <dirent.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <time.h>
#include "constants.h"
#include "validate.h"
#include "list.h"
#include "magic_test.h"
#include "extension_test.h"
#include "scan_file.h"
#include "logging.h"
#include "list_test.h"
int error;
int cwd_size;
// ----------------------------------------------------------------------
// dirinfo struct holds a list of files and subdirectories in it. One
// can run out of file handles if one is not careful in recursively
// descending a filesystem. So, when a directory entry is read, its
// contents are stored in these linked lists, and the handle is
// closed.
// ----------------------------------------------------------------------
struct dirinfo
{
struct node *files;
struct node *subdirs;
};
// ----------------------------------------------------------------------
// Function listing
// ----------------------------------------------------------------------
char * get_cwd();
struct dirinfo * read_directory(char *dirname);
void free_directory(struct dirinfo *info);
struct ssn_results traverse_directory(char *dirname, struct ssn_results results);
int main (int argc, char **argv);
void show_result(char *filename, struct ssn_results results);
void process_dir_entry(struct dirent *entry, char *cwd, struct dirinfo *info, char *newnode);
void process_file_entry(struct dirent *entry, char *cwd, struct dirinfo *info, char *newnode);
void show_summary_stats(struct ssn_results results);
void blank_results(struct ssn_results * results);
void banner();
void configuration_notifications();
int process_args(int argc, char **argv);
void usage();
struct ssn_results initiate_scan(char *filename, struct ssn_results results);
int skip_any(char *cwd, char *filename);
#endif