Anope IRC Services

Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: How to parse the anope .db database  (Read 6075 times)

0 Members and 1 Guest are viewing this topic.

Adonis

  • Anope User
  • Offline Offline
  • Posts: 11
How to parse the anope .db database
« on: June 20, 2008, 04:41:20 AM »

I know my previous topic was closed, and i know that full mysql support is not to be expected any time soon.

I was wondering if someone ever attempted to have php/perl or whatever, parse the Anope .db databases to human readable form, and then store it in MySQL? I want to make an app that does one way (read only) access to the Anope services database for several different purposes. Since it doesn't have to be real time, it would be sufficient to re-parse and store to MySQL only once per hour or so.

Any one ever done this? I would like to do it, but the .db files are hardly readable.
Logged

Jobe

  • Contributor
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 1023
    • Anope IRC Services
(No subject)
« Reply #1 on: June 20, 2008, 09:16:51 AM »

You could always compile Anope with MySQL support and enable the MySQL options to make Anope save it's data to MySQL anyway.

As for parsing the .db files, they are a custom format with no specification that I know of.

[Edited on 20-6-2008 by Jobe1986]
Logged
Your IP: ()
My IRC Status:

Come along and visit http://www.anopequotes.org/

Jan Milants

  • Team
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 1372
(No subject)
« Reply #2 on: June 20, 2008, 12:35:39 PM »

correct.. to parse them you d have take a look at how they are stored/read by anope and then copy that to your perl script. it s all custom binary, so there s no existing library or so that can parse them.
Maybe looking at some database conversion tools may also help, though those are usually very basic, it s easier to get the overall picture in them.
Logged
If you like me donate coins to 1FBmZVT4J8WAUMHKqpWhgNVj3XXnRN1cCk :)

Trystan Scott Lee

  • Contributor
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 343
(No subject)
« Reply #3 on: June 20, 2008, 10:22:36 PM »

Parsing a anope db with php is possible, I had a rough one done for half of the nickserv info at one time, mostly gotta port the read16 and read32 to php which if you can read C and know PHP the process is easy to do. After that follow the load_ns_db() functions duplicate what it does and you can get the info out of a database.
Logged
my God my tourniquet, return to me salvation

Adonis

  • Anope User
  • Offline Offline
  • Posts: 11
(No subject)
« Reply #4 on: June 21, 2008, 02:01:16 AM »

Unfortunately i don't know C, but if you can possibly post an example, i'll be able to figure it out.
Logged
Pages: [1]   Go Up