You can implement your own application that sends data to Feed Service for checking against feeds.
This section explains how to implement a Python® application that uses Feed Service to check data against feeds.
To check data against feeds in a Python application:
lookup_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
lookup_socket.connect((FS_HOST, FS_PORT))
lookup_socket.send("X-KF-ReplyBack")
Here FS_HOST and FS_PORT are the IP address and port that Feed Service listens on for incoming events. These IP address and port are specified in the "InputSettings > ConnectionString"
element of the Feed Service configuration file. Use the code above if Feed Service sends back an event containing the check result (namely, if the enable
attribute of the FinishedEventFormat
configuration file element is set to true
).
If Feed Service does not send back an event containing the check result (namely, if the enable
attribute of the FinishedEventFormat
configuration file element is set to false
), use the following code instead:
lookup_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
lookup_socket.connect((FS_HOST, FS_PORT))
lookup_socket.send("X-KF-SendFinishedEventX-KF-ReplyBack")
The "X-KF-SendFinishedEvent"
event must precede the "X-KF-ReplyBack"
event.
lookup_socket.send(lookup_value)
result = lookup_socket.recv(16384)
Here lookup_value
is a URL, IP address, hash, or a line from a log file that is to be checked by Feed Service. The data in lookup_value
must be terminated by a newline symbol (0x0A
).
If Feed Service issues a detection event, the result
variable will contain this event. If Feed Service does not issues a detection event, but issues an event that informs the user that the checking process has finished, the result
variable will contain this event.
lookup_socket.close()