|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Tue Apr 29, 2008 10:40 pm
Stringlist |
You guys seem to know this site far better than me. Can someone link me some stringlist help? And also, knowing that I'll be using it for the attack types, any suggestions that the help might not cover?
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Apr 29, 2008 11:21 pm |
There's not a lot to say except this. If you have any specific questions, just ask them.
|
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Wed Apr 30, 2008 3:31 am |
So how do I create a stringlist? I was told it could be managed similar to a database? But the syntax I see is just like any normal variable.
Also, I'd like to keep the values inside a .txt file for easy transfer/replacement, would copying and pasting values already in the variable cause problems? |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4715 Location: Pensacola, FL, USA
|
Posted: Wed Apr 30, 2008 4:33 am |
its a type of variable
variable="item1|item2|item3"
#VAR variable {item1|item2|item3}
#ADDITEM for single instance
%additem for multiple instance
%ismember to check |
|
_________________ Discord: Shalimarwildcat |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Wed Apr 30, 2008 1:11 pm |
The variable you have defined there seems different from what I'm used to declaring
#var <name> value default_value {class}
Also, I saw that on the page and I have it book marked. I guess I wasn't really clear when I made that statement.
It appears just like any other normal variable, it's properties just seem to define it. But I heard it could be edited like a database? (long list of entries in fields)
And since I keep a lot of stuff in .txt file, if I copy and pasted everything, including new values, to the new variable, would it overwrite ones that matched exactly the same? |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Wed Apr 30, 2008 1:45 pm |
I think I understand the questions.
You can define the string list variables the way you are used to doing variables.
#VAR variable {item1|item2|item3} _nodef {class}
Any regular variable can be made into a string list by simply setting its value to a list separated by vertical bars.
#var normvar "I'm a string variable."
normvar = "String1|String2|String3" //It is now a string list variable.
If you edit these variables via the package editor they will show up as you say like a database variable. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Wed Apr 30, 2008 1:45 pm |
#var <name> value default_value {class}
#var <name> {apple|banana|carrot} default_value {class}
It is as it is named a stringlist is a list of strings as you can see which is stored in a variable. You can edit it by using the commands that shalimar listed above. Of course there are more commands to edit it which you can find on the page that Fang linked for you. As for editing it like a database as you can see from the linked page there are commands that are equivalent to select, insert, update and delete so sure if you like the comparison stick with it otherwise treat it as a new friend that you have to get used to.
#var testofstringlist {this|does|not|exist}
#var testofstringlist {hello|world}
#forall @testofstringlist {#echo Item: %i}
Copy and paste the above lines into the CMUD command line and press enter, you should end up with the following displayed on screen
Item: hello
Item: world
So as you can see if you keep your stringlist in a text file and it contains everything you need in it every time you copy and paste it into the command line you will get everything you need in your stringlist, basically it overwrites it. So like you say if you keep your text file up to date with new values and copy and paste it in it will overwrite what you already have, if you define a new variable name it will create a new variable with all your up to date entries.
EDIT: Ninja! You've got to love it when that happens, just pipped to the post on the same minute while posting the same information. |
|
_________________ Taz :) |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Wed Apr 30, 2008 1:52 pm |
Yes well Taz, you did give a bit more info than I did. So it's all good.
|
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Wed Apr 30, 2008 2:18 pm |
Thanks
|
|
|
|
gamma_ray Magician
Joined: 17 Apr 2005 Posts: 496
|
Posted: Wed Apr 30, 2008 9:38 pm |
Hey, I was the one who mentioned that to you (I think)...
In scripts, you can also use #additem #delitem %additem and %delitem (besides command v. function, %additem will add a duplicate if the string list already contains that item, while #additem won't, and #delitem will delete every instance of the item in the string list while %delitem will only delete the first).
But really the way for you to go for what you're doing is just using the GUI in the settings editor. |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Thu May 01, 2008 12:32 am |
can I export the list?
|
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Thu May 01, 2008 1:15 am |
You can yes.
Highlight the variable in the tree view, right click it, select copy, then paste it into a text file.
You could also set the variable to string literal, highlight the value, copy it.
Then do
#var varname {paste stuff here} _nodef {class} |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Thu May 01, 2008 1:35 am |
how do I set the variable to string literal?
|
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Thu May 01, 2008 1:44 am |
When you have the variable highlighted in the tree view you can edit the values of the variable.
There is a label that says type, usually it says Autotype, but it is a drop down list, Select the String (literal) item in that list. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Thu May 01, 2008 2:10 am |
thanks
|
|
|
|
|
|