~ubuntu-branches/ubuntu/utopic/clamav/utopic-security

« back to all changes in this revision

Viewing changes to docs/html/node51.html

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2014-02-01 11:06:17 UTC
  • mfrom: (0.35.37 sid)
  • Revision ID: package-import@ubuntu.com-20140201110617-33h2xxk09dep0ui4
Tags: 0.98.1+dfsg-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - Drop build-dep on electric-fence (in Universe)
  - Add apparmor profiles for clamd and freshclam along with maintainer
    script changes
  - Add autopkgtest

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
8
8
<HTML>
9
9
<HEAD>
10
 
<TITLE>Data scan functions</TITLE>
11
 
<META NAME="description" CONTENT="Data scan functions">
 
10
<TITLE>Initialization</TITLE>
 
11
<META NAME="description" CONTENT="Initialization">
12
12
<META NAME="keywords" CONTENT="clamdoc">
13
13
<META NAME="resource-type" CONTENT="document">
14
14
<META NAME="distribution" CONTENT="global">
20
20
 
21
21
<LINK REL="next" HREF="node52.html">
22
22
<LINK REL="previous" HREF="node50.html">
23
 
<LINK REL="up" HREF="node43.html">
 
23
<LINK REL="up" HREF="node49.html">
24
24
<LINK REL="next" HREF="node52.html">
25
25
</HEAD>
26
26
 
27
27
<BODY >
28
28
 
29
29
<DIV CLASS="navigation"><!--Navigation Panel-->
30
 
<A NAME="tex2html882"
 
30
<A NAME="tex2html899"
31
31
  HREF="node52.html">
32
32
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
33
 
<A NAME="tex2html878"
34
 
  HREF="node43.html">
 
33
<A NAME="tex2html895"
 
34
  HREF="node49.html">
35
35
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
36
 
<A NAME="tex2html872"
 
36
<A NAME="tex2html889"
37
37
  HREF="node50.html">
38
38
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
39
 
<A NAME="tex2html880"
 
39
<A NAME="tex2html897"
40
40
  HREF="node1.html">
41
41
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>  
42
42
<BR>
43
 
<B> Next:</B> <A NAME="tex2html883"
44
 
  HREF="node52.html">Memory</A>
45
 
<B> Up:</B> <A NAME="tex2html879"
46
 
  HREF="node43.html">API</A>
47
 
<B> Previous:</B> <A NAME="tex2html873"
48
 
  HREF="node50.html">Database checks</A>
49
 
 &nbsp; <B>  <A NAME="tex2html881"
 
43
<B> Next:</B> <A NAME="tex2html900"
 
44
  HREF="node52.html">Database loading</A>
 
45
<B> Up:</B> <A NAME="tex2html896"
 
46
  HREF="node49.html">API</A>
 
47
<B> Previous:</B> <A NAME="tex2html890"
 
48
  HREF="node50.html">Header file</A>
 
49
 &nbsp; <B>  <A NAME="tex2html898"
50
50
  HREF="node1.html">Contents</A></B> 
51
51
<BR>
52
52
<BR></DIV>
53
53
<!--End of Navigation Panel-->
54
54
 
55
 
<H3><A NAME="SECTION00073800000000000000">
56
 
Data scan functions</A>
 
55
<H3><A NAME="SECTION00073200000000000000">
 
56
Initialization</A>
57
57
</H3>
58
 
    It's possible to scan a file or descriptor using:
59
 
    <PRE>
60
 
        int cl_scanfile(const char *filename, const char **virname,
61
 
        unsigned long int *scanned, const struct cl_engine *engine,
62
 
        unsigned int options);
63
 
 
64
 
        int cl_scandesc(int desc, const char **virname, unsigned
65
 
        long int *scanned, const struct cl_engine *engine,
66
 
        unsigned int options);
67
 
</PRE>
68
 
    Both functions will store a virus name under the pointer <code>virname</code>,
69
 
    the virus name is part of the engine structure and must not be released
70
 
    directly. If the third argument (<code>scanned</code>) is not NULL, the
71
 
    functions will increase its value with the size of scanned data (in
72
 
    <code>CL_COUNT_PRECISION</code> units).
73
 
    The last argument (<code>options</code>) specified the scan options and supports
74
 
    the following flags (which can be combined using bit operators):
75
 
    
76
 
<UL>
77
 
<LI><SPAN  CLASS="textbf">CL_SCAN_STDOPT</SPAN>
78
 
<BR>
79
 
This is an alias for a recommended set of scan options. You
80
 
              should use it to make your software ready for new features
81
 
              in the future versions of libclamav.
82
 
</LI>
83
 
<LI><SPAN  CLASS="textbf">CL_SCAN_RAW</SPAN>
84
 
<BR>
85
 
Use it alone if you want to disable support for special files.
86
 
</LI>
87
 
<LI><SPAN  CLASS="textbf">CL_SCAN_ARCHIVE</SPAN>
88
 
<BR>
89
 
This flag enables transparent scanning of various archive formats.
90
 
</LI>
91
 
<LI><SPAN  CLASS="textbf">CL_SCAN_BLOCKENCRYPTED</SPAN>
92
 
<BR>
93
 
With this flag the library will mark encrypted archives as viruses
94
 
              (Encrypted.Zip, Encrypted.RAR).
95
 
</LI>
96
 
<LI><SPAN  CLASS="textbf">CL_SCAN_MAIL</SPAN>
97
 
<BR>
98
 
Enable support for mail files.
99
 
</LI>
100
 
<LI><SPAN  CLASS="textbf">CL_SCAN_OLE2</SPAN>
101
 
<BR>
102
 
Enables support for OLE2 containers (used by MS Office and .msi
103
 
              files).
104
 
</LI>
105
 
<LI><SPAN  CLASS="textbf">CL_SCAN_PDF</SPAN>
106
 
<BR>
107
 
Enables scanning within PDF files.
108
 
</LI>
109
 
<LI><SPAN  CLASS="textbf">CL_SCAN_PE</SPAN>
110
 
<BR>
111
 
This flag enables deep scanning of Portable Executable files and
112
 
              allows libclamav to unpack executables compressed with run-time
113
 
              unpackers.
114
 
</LI>
115
 
<LI><SPAN  CLASS="textbf">CL_SCAN_ELF</SPAN>
116
 
<BR>
117
 
Enable support for ELF files.
118
 
</LI>
119
 
<LI><SPAN  CLASS="textbf">CL_SCAN_BLOCKBROKEN</SPAN>
120
 
<BR>
121
 
libclamav will try to detect broken executables and mark them as
122
 
              Broken.Executable.
123
 
</LI>
124
 
<LI><SPAN  CLASS="textbf">CL_SCAN_HTML</SPAN>
125
 
<BR>
126
 
This flag enables HTML normalisation (including ScrEnc
127
 
              decryption).
128
 
</LI>
129
 
<LI><SPAN  CLASS="textbf">CL_SCAN_ALGORITHMIC</SPAN>
130
 
<BR>
131
 
Enable algorithmic detection of viruses.
132
 
</LI>
133
 
<LI><SPAN  CLASS="textbf">CL_SCAN_PHISHING_BLOCKSSL</SPAN>
134
 
<BR>
135
 
Phishing module: always block SSL mismatches in URLs.
136
 
</LI>
137
 
<LI><SPAN  CLASS="textbf">CL_SCAN_PHISHING_BLOCKCLOAK</SPAN>
138
 
<BR>
139
 
Phishing module: always block cloaked URLs.
140
 
</LI>
141
 
<LI><SPAN  CLASS="textbf">CL_SCAN_STRUCTURED</SPAN>
142
 
<BR>
143
 
Enable the DLP module which scans for credit card and SSN
144
 
              numbers.
145
 
</LI>
146
 
<LI><SPAN  CLASS="textbf">CL_SCAN_STRUCTURED_SSN_NORMAL</SPAN>
147
 
<BR>
148
 
Search for SSNs formatted as xx-yy-zzzz.
149
 
</LI>
150
 
<LI><SPAN  CLASS="textbf">CL_SCAN_STRUCTURED_SSN_STRIPPED</SPAN>
151
 
<BR>
152
 
Search for SSNs formatted as xxyyzzzz.
153
 
</LI>
154
 
<LI><SPAN  CLASS="textbf">CL_SCAN_PARTIAL_MESSAGE</SPAN>
155
 
<BR>
156
 
Scan RFC1341 messages split over many emails. You will need to
157
 
              periodically clean up <code>$TemporaryDirectory/clamav-partial</code>
158
 
              directory.
159
 
</LI>
160
 
<LI><SPAN  CLASS="textbf">CL_SCAN_HEURISTIC_PRECEDENCE</SPAN>
161
 
<BR>
162
 
Allow heuristic match to take precedence. When enabled, if
163
 
              a heuristic scan (such as phishingScan) detects a possible
164
 
              virus/phish it will stop scan immediately. Recommended, saves CPU
165
 
              scan-time. When disabled, virus/phish detected by heuristic scans
166
 
              will be reported only at the end of a scan. If an archive
167
 
              contains both a heuristically detected virus/phishing, and a real
168
 
              malware, the real malware will be reported.
169
 
</LI>
170
 
<LI><SPAN  CLASS="textbf">CL_SCAN_BLOCKMACROS</SPAN>
171
 
<BR>
172
 
OLE2 containers, which contain VBA macros will be marked infected
173
 
              (Heuristics.OLE2.ContainsMacros).
174
 
    
175
 
</LI>
176
 
</UL>
177
 
    All functions return <code>CL_CLEAN</code> when the file seems clean,
178
 
    <code>CL_VIRUS</code> when a virus is detected and another value on failure.
179
 
    <PRE>
180
 
            ...
181
 
            const char *virname;
182
 
 
183
 
        if((ret = cl_scanfile("/tmp/test.exe", &amp;virname, NULL, engine,
184
 
        CL_SCAN_STDOPT)) == CL_VIRUS) {
185
 
            printf("Virus detected: %s\n", virname);
186
 
        } else {
187
 
            printf("No virus detected.\n");
188
 
            if(ret != CL_CLEAN)
189
 
                printf("Error: %s\n", cl_strerror(ret));
190
 
        }
191
 
</PRE>
 
58
    Before using libclamav, you should call <code>cl_init()</code> to initialize
 
59
    it. When it's done, you're ready to create a new scan engine by calling
 
60
    <code>cl_engine_new()</code>. To free resources allocated by the engine use
 
61
    <code>cl_engine_free()</code>. Function prototypes:
 
62
    <PRE>
 
63
        int cl_init(unsigned int options);
 
64
        struct cl_engine *cl_engine_new(void);
 
65
        int cl_engine_free(struct cl_engine *engine);
 
66
</PRE>
 
67
    <code>cl_init()</code> and <code>cl_engine_free()</code> return <code>CL_SUCCESS</code>
 
68
    on success or another code on error. <code>cl_engine_new()</code> return
 
69
    a pointer or NULL if there's not enough memory to allocate a new
 
70
    engine structure.
192
71
 
193
72
<P>
194
 
 
195
 
<DIV CLASS="navigation"><HR>
196
 
<!--Navigation Panel-->
197
 
<A NAME="tex2html882"
198
 
  HREF="node52.html">
199
 
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
200
 
<A NAME="tex2html878"
201
 
  HREF="node43.html">
202
 
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
203
 
<A NAME="tex2html872"
204
 
  HREF="node50.html">
205
 
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
206
 
<A NAME="tex2html880"
207
 
  HREF="node1.html">
208
 
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A>  
209
 
<BR>
210
 
<B> Next:</B> <A NAME="tex2html883"
211
 
  HREF="node52.html">Memory</A>
212
 
<B> Up:</B> <A NAME="tex2html879"
213
 
  HREF="node43.html">API</A>
214
 
<B> Previous:</B> <A NAME="tex2html873"
215
 
  HREF="node50.html">Database checks</A>
216
 
 &nbsp; <B>  <A NAME="tex2html881"
217
 
  HREF="node1.html">Contents</A></B> </DIV>
218
 
<!--End of Navigation Panel-->
 
73
<BR><HR>
219
74
<ADDRESS>
220
 
SourceFire 2013-04-16
 
75
Sourcefire 2013-12-24
221
76
</ADDRESS>
222
77
</BODY>
223
78
</HTML>