• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

parsesnip source

calvary1980

New Member
Joined
Dec 26, 2007
Messages
1,801 (0.30/day)
Location
Toronto, CA
Processor Intel Core 2 Quad Q6600 Kentsfield L724A629 @ 3.8Ghz 423x9 1.47v
Motherboard Abit IP-35 Pro Beta 16.B04 (vDroop)
Cooling 6x Scythe S-Flex SFF21F, EK Multi Option 2 Port, dB-1 Compact, Swiftech MCR80, Swiftech Apogee GT
Memory 2x1 OCZ Flex XLC PC-9200 @ 5-5-5-18 1220 2.3v
Video Card(s) Inno3D Geforce 8800GTS 320
Storage Western Digital Raptor X 150
Display(s) Samsung Syncmaster 226BW 22"
Case Cooler Master RC-690
Audio Device(s) Creative SoundBlaster X-Fi Xtreme Gamer 7.1
Power Supply Thermaltake ToughPower 1000
C++: Parsesnip Source

being a security enthusiast I usually find my self writing little tools like this on the fly I wrote this a couple years ago and planned on releasing it but never did, since the programming section is pretty quiet these days I see no harm.

Code:
// parsesnip
// version 1.0
// author Christine "calvary" C.
// this tool is used to parse common combinations from selected
// input file to output file with the option of a histogram
// available format http://*:*@* to *:*

// coming soon support for Zima and Crime formats

#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <vector>

#define DUP_THRESHOLD 20

using namespace std;

void print_vector(vector<string> & vec);

int main(int argc, char * argv[]){

	string input_fn;
	string output_fn;
	string make_hist;
	int threshold;
	cout<<"enter the path of the input file: ";
	cin>>input_fn;
	cout<<"enter the path of the output file: ";
	cin>>output_fn;
	cout<<"how many instances constitues a common combination (num > 1) : ";
	cin>>threshold;
	cout<<"would you like to make a histogram (y/n): ";
	cin>>make_hist;
	cout<<endl;
	
	vector<string> vl_vec;
	vector<string>::iterator new_end;
	string line;
	string::iterator line_iter;
	string base;
	ifstream in(input_fn.c_str());
	if(!in.good()){
		cout<<"error: "<<input_fn<<" could not be opened \n";
		cin>>input_fn;
		exit(1);
	}
	while (!in.eof()){
		in>>line;
		line_iter = line.begin();
		line_iter += 7;
		
		while(*(++line_iter) != '/');
		line_iter++;
		base.erase(base.begin(),base.end());
		base.resize(line_iter - line.begin() + 1);
		copy(line.begin(), line_iter,base.begin());
		vl_vec.push_back(base);
	}
	sort(vl_vec.begin(),vl_vec.end());
	new_end = unique(vl_vec.begin(),vl_vec.end());
	vl_vec.erase(new_end + 1,vl_vec.end());

	vector<string> combo_vec;
	for(vector<string>::iterator cur = vl_vec.begin();
		cur < new_end;
		cur++){
			line_iter = cur->begin();
			line_iter += 7;
			while(*(++line_iter) != '@');
			base.erase(base.begin(),base.end());
			base.resize(line_iter - cur->begin() - 6);
			copy(cur->begin()+7,line_iter,base.begin());
			combo_vec.push_back(base);
		};

	ofstream out(output_fn.c_str());
	int dups;
	string cur_combo;
	for(vector<string>::iterator cur2 = combo_vec.begin();
		cur2 < combo_vec.end();
		cur2++){
			dups = 0;
			cur_combo = *cur2;
			while(cur_combo == *cur2 && cur2 < combo_vec.end() - 1){ 
				cur2++; 
				dups++;
			};
			
			if(toupper(make_hist[0]) == 'Y'){
				out.width(25);
			}
			if(dups >= threshold){
				out<<cur_combo<<" ";
				if(toupper(make_hist[0]) == 'Y'){
					cout<<" ";
					for(int i=0; i<dups; i++)
						out<<"|";
				}
				out<<endl;
			}
		}
		
	return 0;
}


void print_vector(vector<string> & vec){ // debug
	for(vector<string>::iterator cur = vec.begin();
		cur < vec.end();
		cur++){
			cout<<*cur<<endl;
		}
}// end print_vector

- Christine
 
Last edited:

Kreij

Senior Monkey Moderator
Joined
Feb 6, 2007
Messages
13,817 (2.20/day)
Location
Cheeseland (Wisconsin, USA)
Thanks Christine, this is good stuff and I just wanted to bump it once more so it does not fade into oblivion too soon ;)

One quick suggestion. When you post a code example , prefix the title with the language you are using. Helps with searching. :toast:
 

calvary1980

New Member
Joined
Dec 26, 2007
Messages
1,801 (0.30/day)
Location
Toronto, CA
Processor Intel Core 2 Quad Q6600 Kentsfield L724A629 @ 3.8Ghz 423x9 1.47v
Motherboard Abit IP-35 Pro Beta 16.B04 (vDroop)
Cooling 6x Scythe S-Flex SFF21F, EK Multi Option 2 Port, dB-1 Compact, Swiftech MCR80, Swiftech Apogee GT
Memory 2x1 OCZ Flex XLC PC-9200 @ 5-5-5-18 1220 2.3v
Video Card(s) Inno3D Geforce 8800GTS 320
Storage Western Digital Raptor X 150
Display(s) Samsung Syncmaster 226BW 22"
Case Cooler Master RC-690
Audio Device(s) Creative SoundBlaster X-Fi Xtreme Gamer 7.1
Power Supply Thermaltake ToughPower 1000
Will do. :)

- Christine
 

Solaris17

Super Dainty Moderator
Staff member
Joined
Aug 16, 2005
Messages
25,865 (3.79/day)
Location
Alabama
System Name Rocinante
Processor I9 14900KS
Motherboard EVGA z690 Dark KINGPIN (modded BIOS)
Cooling EK-AIO Elite 360 D-RGB
Memory 64GB Gskill Trident Z5 DDR5 6000 @6400
Video Card(s) MSI SUPRIM Liquid X 4090
Storage 1x 500GB 980 Pro | 1x 1TB 980 Pro | 1x 8TB Corsair MP400
Display(s) Odyssey OLED G9 G95SC
Case Lian Li o11 Evo Dynamic White
Audio Device(s) Moondrop S8's on Schiit Hel 2e
Power Supply Bequiet! Power Pro 12 1500w
Mouse Lamzu Atlantis mini (White)
Keyboard Monsgeek M3 Lavender, Akko Crystal Blues
VR HMD Quest 3
Software Windows 11
Benchmark Scores I dont have time for that.
man you guys know so much cool stuff i wish i could code like you guys.
 

Kreij

Senior Monkey Moderator
Joined
Feb 6, 2007
Messages
13,817 (2.20/day)
Location
Cheeseland (Wisconsin, USA)

Oliver_FF

New Member
Joined
Oct 15, 2006
Messages
544 (0.09/day)
Processor Intel q9400 @ stock
Motherboard Lanparty P45-T2RS
Cooling Zalman CNPS-9500
Memory 8GB OCZ PC2-6400
Video Card(s) BFG Nvidia GTX285 OC
Storage 1TB, 500GB, 500GB
Display(s) 20" Samsung T200HD
Case Antec Mini P180
Audio Device(s) Sound Blaster X-Fi Elite Pro
Power Supply 700w Hiper
Software Ubuntu x64 virtualising Vista
Seriously cool code, between myself and all of my mates I'm usually the first to attempt to make some code run as fast as possible XD

As far as I know I hold the record at my university for the fastest time to search modem connection logs to determine the times that all modems are concurrently connected - running the code on a server for everyones times to be comparable. Gotta love Algorithm assignments :eek:

You know, if you first poster goes to Edit their post, in this case, Christine, then pick Advanced View, you can change the title of the thread?
 

calvary1980

New Member
Joined
Dec 26, 2007
Messages
1,801 (0.30/day)
Location
Toronto, CA
Processor Intel Core 2 Quad Q6600 Kentsfield L724A629 @ 3.8Ghz 423x9 1.47v
Motherboard Abit IP-35 Pro Beta 16.B04 (vDroop)
Cooling 6x Scythe S-Flex SFF21F, EK Multi Option 2 Port, dB-1 Compact, Swiftech MCR80, Swiftech Apogee GT
Memory 2x1 OCZ Flex XLC PC-9200 @ 5-5-5-18 1220 2.3v
Video Card(s) Inno3D Geforce 8800GTS 320
Storage Western Digital Raptor X 150
Display(s) Samsung Syncmaster 226BW 22"
Case Cooler Master RC-690
Audio Device(s) Creative SoundBlaster X-Fi Xtreme Gamer 7.1
Power Supply Thermaltake ToughPower 1000
done.

- Christine
 

calvary1980

New Member
Joined
Dec 26, 2007
Messages
1,801 (0.30/day)
Location
Toronto, CA
Processor Intel Core 2 Quad Q6600 Kentsfield L724A629 @ 3.8Ghz 423x9 1.47v
Motherboard Abit IP-35 Pro Beta 16.B04 (vDroop)
Cooling 6x Scythe S-Flex SFF21F, EK Multi Option 2 Port, dB-1 Compact, Swiftech MCR80, Swiftech Apogee GT
Memory 2x1 OCZ Flex XLC PC-9200 @ 5-5-5-18 1220 2.3v
Video Card(s) Inno3D Geforce 8800GTS 320
Storage Western Digital Raptor X 150
Display(s) Samsung Syncmaster 226BW 22"
Case Cooler Master RC-690
Audio Device(s) Creative SoundBlaster X-Fi Xtreme Gamer 7.1
Power Supply Thermaltake ToughPower 1000
check out my new sig! what do you think :laugh:

- Christine
 

Solaris17

Super Dainty Moderator
Staff member
Joined
Aug 16, 2005
Messages
25,865 (3.79/day)
Location
Alabama
System Name Rocinante
Processor I9 14900KS
Motherboard EVGA z690 Dark KINGPIN (modded BIOS)
Cooling EK-AIO Elite 360 D-RGB
Memory 64GB Gskill Trident Z5 DDR5 6000 @6400
Video Card(s) MSI SUPRIM Liquid X 4090
Storage 1x 500GB 980 Pro | 1x 1TB 980 Pro | 1x 8TB Corsair MP400
Display(s) Odyssey OLED G9 G95SC
Case Lian Li o11 Evo Dynamic White
Audio Device(s) Moondrop S8's on Schiit Hel 2e
Power Supply Bequiet! Power Pro 12 1500w
Mouse Lamzu Atlantis mini (White)
Keyboard Monsgeek M3 Lavender, Akko Crystal Blues
VR HMD Quest 3
Software Windows 11
Benchmark Scores I dont have time for that.
thiats nice cristine whant to know what gives it away?


nobody writes a smiley face side ways ;)

and even though you did a good job congrats on finding the font...the slight pixilation can be seen if you have good eyes.

maybe i cant program but i do make things

 

Solaris17

Super Dainty Moderator
Staff member
Joined
Aug 16, 2005
Messages
25,865 (3.79/day)
Location
Alabama
System Name Rocinante
Processor I9 14900KS
Motherboard EVGA z690 Dark KINGPIN (modded BIOS)
Cooling EK-AIO Elite 360 D-RGB
Memory 64GB Gskill Trident Z5 DDR5 6000 @6400
Video Card(s) MSI SUPRIM Liquid X 4090
Storage 1x 500GB 980 Pro | 1x 1TB 980 Pro | 1x 8TB Corsair MP400
Display(s) Odyssey OLED G9 G95SC
Case Lian Li o11 Evo Dynamic White
Audio Device(s) Moondrop S8's on Schiit Hel 2e
Power Supply Bequiet! Power Pro 12 1500w
Mouse Lamzu Atlantis mini (White)
Keyboard Monsgeek M3 Lavender, Akko Crystal Blues
VR HMD Quest 3
Software Windows 11
Benchmark Scores I dont have time for that.
awww s#$%T i just burned the final of that disk to :(


i used cd menu pro 6 to make an autorun splash
 

calvary1980

New Member
Joined
Dec 26, 2007
Messages
1,801 (0.30/day)
Location
Toronto, CA
Processor Intel Core 2 Quad Q6600 Kentsfield L724A629 @ 3.8Ghz 423x9 1.47v
Motherboard Abit IP-35 Pro Beta 16.B04 (vDroop)
Cooling 6x Scythe S-Flex SFF21F, EK Multi Option 2 Port, dB-1 Compact, Swiftech MCR80, Swiftech Apogee GT
Memory 2x1 OCZ Flex XLC PC-9200 @ 5-5-5-18 1220 2.3v
Video Card(s) Inno3D Geforce 8800GTS 320
Storage Western Digital Raptor X 150
Display(s) Samsung Syncmaster 226BW 22"
Case Cooler Master RC-690
Audio Device(s) Creative SoundBlaster X-Fi Xtreme Gamer 7.1
Power Supply Thermaltake ToughPower 1000
what about now? :laugh:

- Christine
 

Solaris17

Super Dainty Moderator
Staff member
Joined
Aug 16, 2005
Messages
25,865 (3.79/day)
Location
Alabama
System Name Rocinante
Processor I9 14900KS
Motherboard EVGA z690 Dark KINGPIN (modded BIOS)
Cooling EK-AIO Elite 360 D-RGB
Memory 64GB Gskill Trident Z5 DDR5 6000 @6400
Video Card(s) MSI SUPRIM Liquid X 4090
Storage 1x 500GB 980 Pro | 1x 1TB 980 Pro | 1x 8TB Corsair MP400
Display(s) Odyssey OLED G9 G95SC
Case Lian Li o11 Evo Dynamic White
Audio Device(s) Moondrop S8's on Schiit Hel 2e
Power Supply Bequiet! Power Pro 12 1500w
Mouse Lamzu Atlantis mini (White)
Keyboard Monsgeek M3 Lavender, Akko Crystal Blues
VR HMD Quest 3
Software Windows 11
Benchmark Scores I dont have time for that.
hahaha :p leave me alone your a programmer you know ill spend 27 hours perfecting this it was a late night running on cold coffe and dreams. dont tell me you dont know what im talking about :p ill fix it though thanks :)
 
Joined
Feb 19, 2007
Messages
12,453 (1.99/day)
Location
Yankee lost in the Mountains of East TN
Processor 5800x(2)/5700g/5600x/5600g/2700x/1700x/1700
Motherboard MSI B550 Carbon (2)/ MSI z490 Unify/Asus Strix B550-F/MSI B450 Tomahawk (3)
Cooling EK AIO 360 (2)/EK AIO 240, Arctic Cooling Freezer II 280/EVGA CLC 280/Noctua D15/Cryorig M9(2)
Memory 32 GB Ballistix Elite/32 GB TridentZ/16GB Mushkin Redline Black/16 GB Dominator
Video Card(s) Asus Strix RTX3060/EVGA 970(2)/Asus 750 ti/Old Quadros
Storage Samsung 970 EVO M.2 NVMe 500GB/WD Black M.2 NVMe 500GB/Adata 500gb NVMe
Display(s) Acer 1080p 22"/ (3) Samsung 22" 1080p
Case (2) Lian Li Lancool II Mesh/Corsair 4000D /Phanteks Eclipse 500a/Be Quiet Pure Base 500/Bones of HAF
Power Supply EVGA Supernova 850G(2)/EVGA Supernova GT 650w/Phantek Amps 750w/Seasonic Focus 750w
Mouse Generic Black wireless (5)
Keyboard Generic Black wireless (5)
Software Win 10/Ubuntu
Nice code Christine. I wish I could enjoy writing code. It's so damn useful.
 

calvary1980

New Member
Joined
Dec 26, 2007
Messages
1,801 (0.30/day)
Location
Toronto, CA
Processor Intel Core 2 Quad Q6600 Kentsfield L724A629 @ 3.8Ghz 423x9 1.47v
Motherboard Abit IP-35 Pro Beta 16.B04 (vDroop)
Cooling 6x Scythe S-Flex SFF21F, EK Multi Option 2 Port, dB-1 Compact, Swiftech MCR80, Swiftech Apogee GT
Memory 2x1 OCZ Flex XLC PC-9200 @ 5-5-5-18 1220 2.3v
Video Card(s) Inno3D Geforce 8800GTS 320
Storage Western Digital Raptor X 150
Display(s) Samsung Syncmaster 226BW 22"
Case Cooler Master RC-690
Audio Device(s) Creative SoundBlaster X-Fi Xtreme Gamer 7.1
Power Supply Thermaltake ToughPower 1000
Thanks Paulie :laugh: ok my sides hurt, im done.

- Christine
 
Last edited:

Solaris17

Super Dainty Moderator
Staff member
Joined
Aug 16, 2005
Messages
25,865 (3.79/day)
Location
Alabama
System Name Rocinante
Processor I9 14900KS
Motherboard EVGA z690 Dark KINGPIN (modded BIOS)
Cooling EK-AIO Elite 360 D-RGB
Memory 64GB Gskill Trident Z5 DDR5 6000 @6400
Video Card(s) MSI SUPRIM Liquid X 4090
Storage 1x 500GB 980 Pro | 1x 1TB 980 Pro | 1x 8TB Corsair MP400
Display(s) Odyssey OLED G9 G95SC
Case Lian Li o11 Evo Dynamic White
Audio Device(s) Moondrop S8's on Schiit Hel 2e
Power Supply Bequiet! Power Pro 12 1500w
Mouse Lamzu Atlantis mini (White)
Keyboard Monsgeek M3 Lavender, Akko Crystal Blues
VR HMD Quest 3
Software Windows 11
Benchmark Scores I dont have time for that.
easy christine...the forum rules say no nudity just a heads.
 

calvary1980

New Member
Joined
Dec 26, 2007
Messages
1,801 (0.30/day)
Location
Toronto, CA
Processor Intel Core 2 Quad Q6600 Kentsfield L724A629 @ 3.8Ghz 423x9 1.47v
Motherboard Abit IP-35 Pro Beta 16.B04 (vDroop)
Cooling 6x Scythe S-Flex SFF21F, EK Multi Option 2 Port, dB-1 Compact, Swiftech MCR80, Swiftech Apogee GT
Memory 2x1 OCZ Flex XLC PC-9200 @ 5-5-5-18 1220 2.3v
Video Card(s) Inno3D Geforce 8800GTS 320
Storage Western Digital Raptor X 150
Display(s) Samsung Syncmaster 226BW 22"
Case Cooler Master RC-690
Audio Device(s) Creative SoundBlaster X-Fi Xtreme Gamer 7.1
Power Supply Thermaltake ToughPower 1000
lighten up, what is this a family forum all of a sudden. they are just boobs you should see the collage of me :p

- Christine
 

Solaris17

Super Dainty Moderator
Staff member
Joined
Aug 16, 2005
Messages
25,865 (3.79/day)
Location
Alabama
System Name Rocinante
Processor I9 14900KS
Motherboard EVGA z690 Dark KINGPIN (modded BIOS)
Cooling EK-AIO Elite 360 D-RGB
Memory 64GB Gskill Trident Z5 DDR5 6000 @6400
Video Card(s) MSI SUPRIM Liquid X 4090
Storage 1x 500GB 980 Pro | 1x 1TB 980 Pro | 1x 8TB Corsair MP400
Display(s) Odyssey OLED G9 G95SC
Case Lian Li o11 Evo Dynamic White
Audio Device(s) Moondrop S8's on Schiit Hel 2e
Power Supply Bequiet! Power Pro 12 1500w
Mouse Lamzu Atlantis mini (White)
Keyboard Monsgeek M3 Lavender, Akko Crystal Blues
VR HMD Quest 3
Software Windows 11
Benchmark Scores I dont have time for that.
lol i dont care in the slightest i just didnt want you to get in trouble im not a prude. ;)
 

intel igent

New Member
Joined
Jun 5, 2005
Messages
4,640 (0.67/day)
Location
Toronto, Canada
System Name old school / new school
Processor 3.0e C0 @ 3.6 / e5200
Motherboard p4p800e-dlx / p5q-DLX
Cooling custom water see sig / air
Memory 2x1g oczPC4000EbPl / 2x2g ocz2rpr1066
Video Card(s) 3850AGP / 4890vaporX
Storage 36g raptor+120g wd / wd 1001fals 1tb
Display(s) BenQ / sharpAQUOS LC-37D64U
Case modded antec plusview / generic
Audio Device(s) audigy 2zs / ASUS Xonar HDAV1.3
Power Supply fan/cable modded powerstream 520 / OCZ 700mxsp
Software Xp pro SP2 / VISTA ultimate OEM
i can't programm but i can laugh! :laugh: :roll: :laugh:

i like the new sig's :)

:toast:
 
Joined
Feb 19, 2007
Messages
12,453 (1.99/day)
Location
Yankee lost in the Mountains of East TN
Processor 5800x(2)/5700g/5600x/5600g/2700x/1700x/1700
Motherboard MSI B550 Carbon (2)/ MSI z490 Unify/Asus Strix B550-F/MSI B450 Tomahawk (3)
Cooling EK AIO 360 (2)/EK AIO 240, Arctic Cooling Freezer II 280/EVGA CLC 280/Noctua D15/Cryorig M9(2)
Memory 32 GB Ballistix Elite/32 GB TridentZ/16GB Mushkin Redline Black/16 GB Dominator
Video Card(s) Asus Strix RTX3060/EVGA 970(2)/Asus 750 ti/Old Quadros
Storage Samsung 970 EVO M.2 NVMe 500GB/WD Black M.2 NVMe 500GB/Adata 500gb NVMe
Display(s) Acer 1080p 22"/ (3) Samsung 22" 1080p
Case (2) Lian Li Lancool II Mesh/Corsair 4000D /Phanteks Eclipse 500a/Be Quiet Pure Base 500/Bones of HAF
Power Supply EVGA Supernova 850G(2)/EVGA Supernova GT 650w/Phantek Amps 750w/Seasonic Focus 750w
Mouse Generic Black wireless (5)
Keyboard Generic Black wireless (5)
Software Win 10/Ubuntu
Christine, YHPM
 
Top