RubyIOC 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +20 -0
- data/Gemfile +3 -0
- data/LICENSE +7 -0
- data/README.md +7 -0
- data/Rakefile +8 -0
- data/RubyIOC.gemspec +24 -0
- data/lib/RubyIOC.rb +39 -0
- data/lib/RubyIOC/ioc.rb +58 -0
- data/lib/RubyIOC/iocitem.rb +59 -0
- data/lib/RubyIOC/iocitem/arp_entry_item.rb +33 -0
- data/lib/RubyIOC/iocitem/cookie_history_item.rb +33 -0
- data/lib/RubyIOC/iocitem/disk_item.rb +33 -0
- data/lib/RubyIOC/iocitem/dns_entry_item.rb +66 -0
- data/lib/RubyIOC/iocitem/driver_item.rb +33 -0
- data/lib/RubyIOC/iocitem/event_log_item.rb +33 -0
- data/lib/RubyIOC/iocitem/file_download_history_item.rb +33 -0
- data/lib/RubyIOC/iocitem/file_item.rb +33 -0
- data/lib/RubyIOC/iocitem/form_history_item.rb +33 -0
- data/lib/RubyIOC/iocitem/hash_item.rb +33 -0
- data/lib/RubyIOC/iocitem/hook_item.rb +33 -0
- data/lib/RubyIOC/iocitem/module_item.rb +33 -0
- data/lib/RubyIOC/iocitem/persistence_item.rb +33 -0
- data/lib/RubyIOC/iocitem/port_item.rb +33 -0
- data/lib/RubyIOC/iocitem/prefetch_item.rb +33 -0
- data/lib/RubyIOC/iocitem/process_item.rb +33 -0
- data/lib/RubyIOC/iocitem/registry_hive_item.rb +33 -0
- data/lib/RubyIOC/iocitem/registry_item.rb +33 -0
- data/lib/RubyIOC/iocitem/route_entry_item.rb +33 -0
- data/lib/RubyIOC/iocitem/service_item.rb +33 -0
- data/lib/RubyIOC/iocitem/string_match_item.rb +33 -0
- data/lib/RubyIOC/iocitem/system_info_item.rb +33 -0
- data/lib/RubyIOC/iocitem/system_restore_item.rb +33 -0
- data/lib/RubyIOC/iocitem/task_item.rb +33 -0
- data/lib/RubyIOC/iocitem/timeline_item.rb +33 -0
- data/lib/RubyIOC/iocitem/url_history_item.rb +33 -0
- data/lib/RubyIOC/iocitem/user_item.rb +81 -0
- data/lib/RubyIOC/iocitem/volume_item.rb +33 -0
- data/lib/RubyIOC/iocterm.rb +22 -0
- data/lib/RubyIOC/platform.rb +55 -0
- data/lib/RubyIOC/scanner.rb +110 -0
- data/lib/RubyIOC/version.rb +15 -0
- data/test/find_windows.ioc +75 -0
- data/test/test_dns_entry_item.ioc +14 -0
- data/test/test_iocitem_factory.rb +17 -0
- data/test/test_scan.rb +16 -0
- data/test/test_user_item.ioc +28 -0
- data/test/zeus.ioc +69 -0
- metadata +103 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
# Copyright (c) 2013 Matt Jezorek
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
4
|
+
# to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
5
|
+
# and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
#
|
7
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
#
|
9
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
11
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
12
|
+
# IN THE SOFTWARE.
|
13
|
+
module RubyIOC
|
14
|
+
module IOCItem
|
15
|
+
class RouteEntryItem < RubyIOC::IOCTerm
|
16
|
+
def get_type
|
17
|
+
"RouteEntryItem"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class RouteEntryItemFactory < RubyIOC::IOCItem::IOCItemFactory
|
22
|
+
def get_type
|
23
|
+
"RouteEntryItem"
|
24
|
+
end
|
25
|
+
|
26
|
+
def create
|
27
|
+
RouteEntryItem.new
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
RouteEntryItemFactory.add_factory(RouteEntryItemFactory)
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Copyright (c) 2013 Matt Jezorek
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
4
|
+
# to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
5
|
+
# and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
#
|
7
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
#
|
9
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
11
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
12
|
+
# IN THE SOFTWARE.
|
13
|
+
module RubyIOC
|
14
|
+
module IOCItem
|
15
|
+
class ServiceItem < RubyIOC::IOCTerm
|
16
|
+
def get_type
|
17
|
+
"ServiceItem"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class ServiceItemFactory < RubyIOC::IOCItem::IOCItemFactory
|
22
|
+
def get_type
|
23
|
+
"ServiceItem"
|
24
|
+
end
|
25
|
+
|
26
|
+
def create
|
27
|
+
ServiceItem.new
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
ServiceItemFactory.add_factory(ServiceItemFactory)
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Copyright (c) 2013 Matt Jezorek
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
4
|
+
# to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
5
|
+
# and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
#
|
7
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
#
|
9
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
11
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
12
|
+
# IN THE SOFTWARE.
|
13
|
+
module RubyIOC
|
14
|
+
module IOCItem
|
15
|
+
class StringMatchItem < RubyIOC::IOCTerm
|
16
|
+
def get_type
|
17
|
+
"StringMatchItem"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class StringMatchItemFactory < RubyIOC::IOCItem::IOCItemFactory
|
22
|
+
def get_type
|
23
|
+
"StringMatchItem"
|
24
|
+
end
|
25
|
+
|
26
|
+
def create
|
27
|
+
StringMatchItem.new
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
StringMatchItemFactory.add_factory(StringMatchItemFactory)
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Copyright (c) 2013 Matt Jezorek
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
4
|
+
# to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
5
|
+
# and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
#
|
7
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
#
|
9
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
11
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
12
|
+
# IN THE SOFTWARE.
|
13
|
+
module RubyIOC
|
14
|
+
module IOCItem
|
15
|
+
class SystemInfoItem < RubyIOC::IOCTerm
|
16
|
+
def get_type
|
17
|
+
"SystemInfoItem"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class SystemInfoItemFactory < RubyIOC::IOCItem::IOCItemFactory
|
22
|
+
def get_type
|
23
|
+
"SystemInfoItem"
|
24
|
+
end
|
25
|
+
|
26
|
+
def create
|
27
|
+
SystemInfoItem.new
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
SystemInfoItemFactory.add_factory(SystemInfoItemFactory)
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Copyright (c) 2013 Matt Jezorek
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
4
|
+
# to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
5
|
+
# and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
#
|
7
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
#
|
9
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
11
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
12
|
+
# IN THE SOFTWARE.
|
13
|
+
module RubyIOC
|
14
|
+
module IOCItem
|
15
|
+
class SystemRestoreItem < RubyIOC::IOCTerm
|
16
|
+
def get_type
|
17
|
+
"SystemRestoreItem"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class SystemRestoreItemFactory < RubyIOC::IOCItem::IOCItemFactory
|
22
|
+
def get_type
|
23
|
+
"SystemRestoreItem"
|
24
|
+
end
|
25
|
+
|
26
|
+
def create
|
27
|
+
SystemRestoreItem.new
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
SystemRestoreItemFactory.add_factory(SystemRestoreItemFactory)
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Copyright (c) 2013 Matt Jezorek
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
4
|
+
# to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
5
|
+
# and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
#
|
7
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
#
|
9
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
11
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
12
|
+
# IN THE SOFTWARE.
|
13
|
+
module RubyIOC
|
14
|
+
module IOCItem
|
15
|
+
class TaskItem < RubyIOC::IOCTerm
|
16
|
+
def get_type
|
17
|
+
"TaskItem"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class TaskItemFactory < RubyIOC::IOCItem::IOCItemFactory
|
22
|
+
def get_type
|
23
|
+
"TaskItem"
|
24
|
+
end
|
25
|
+
|
26
|
+
def create
|
27
|
+
TaskItem.new
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
TaskItemFactory.add_factory(TaskItemFactory)
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Copyright (c) 2013 Matt Jezorek
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
4
|
+
# to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
5
|
+
# and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
#
|
7
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
#
|
9
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
11
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
12
|
+
# IN THE SOFTWARE.
|
13
|
+
module RubyIOC
|
14
|
+
module IOCItem
|
15
|
+
class TimelineItem < RubyIOC::IOCTerm
|
16
|
+
def get_type
|
17
|
+
"TimelineItem"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class TimelineItemFactory < RubyIOC::IOCItem::IOCItemFactory
|
22
|
+
def get_type
|
23
|
+
"TimelineItem"
|
24
|
+
end
|
25
|
+
|
26
|
+
def create
|
27
|
+
TimelineItem.new
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
TimelineItemFactory.add_factory(TimelineItemFactory)
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Copyright (c) 2013 Matt Jezorek
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
4
|
+
# to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
5
|
+
# and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
#
|
7
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
#
|
9
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
11
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
12
|
+
# IN THE SOFTWARE.
|
13
|
+
module RubyIOC
|
14
|
+
module IOCItem
|
15
|
+
class UrlHistoryItem < RubyIOC::IOCTerm
|
16
|
+
def get_type
|
17
|
+
"UrlHistoryItem"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class UrlHistoryItemFactory < RubyIOC::IOCItem::IOCItemFactory
|
22
|
+
def get_type
|
23
|
+
"UrlHistoryItem"
|
24
|
+
end
|
25
|
+
|
26
|
+
def create
|
27
|
+
UrlHistoryItem.new
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
UrlHistoryItemFactory.add_factory(UrlHistoryItemFactory)
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# Copyright (c) 2013 Matt Jezorek
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
4
|
+
# to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
5
|
+
# and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
#
|
7
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
#
|
9
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
11
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
12
|
+
# IN THE SOFTWARE.
|
13
|
+
require "yaml"
|
14
|
+
if RubyIOC::Platform.windows?
|
15
|
+
require "win32ole"
|
16
|
+
end
|
17
|
+
module RubyIOC
|
18
|
+
module IOCItem
|
19
|
+
class UserItem < RubyIOC::IOCTerm
|
20
|
+
def get_type
|
21
|
+
"UserItem"
|
22
|
+
end
|
23
|
+
|
24
|
+
def scan(indicator)
|
25
|
+
if RubyIOC::Platform.windows?
|
26
|
+
return search_windows_users(indicator)
|
27
|
+
else
|
28
|
+
puts "Not implemented on this platform yet"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def search_windows_users(indicator)
|
33
|
+
wmi = WIN32OLE.connect("winmgmts://")
|
34
|
+
query = "Select * from Win32_UserAccount Where LocalAccount = True and "
|
35
|
+
attributes = []
|
36
|
+
indicator.each { |i|
|
37
|
+
case i[:search]
|
38
|
+
when "UserItem/username"
|
39
|
+
attributes << "Name = \"#{i[:content]}\""
|
40
|
+
when "UserItem/fullname"
|
41
|
+
attributes << "FullName = \"#{i[:content]}\""
|
42
|
+
when "UserItem/description"
|
43
|
+
attributes << "Description = \"#{i[:content]}\""
|
44
|
+
when "UserItem/grouplist"
|
45
|
+
when "UserItem/SecurityID"
|
46
|
+
attributes << "SID = \"#{i[:content]}\""
|
47
|
+
when "UserItem/SecurityType"
|
48
|
+
attributes << "SIDType = \"#{i[:content]}\""
|
49
|
+
when "UserItem/LastLogin"
|
50
|
+
when "UserItem/disabled"
|
51
|
+
attributes << "Disabled = #{i[:content].to_bool}"
|
52
|
+
when "UserItem/lockedout"
|
53
|
+
attributes << "Lockout = #{i[:content].to_bool}"
|
54
|
+
when "UserItem/passwordrequired"
|
55
|
+
when "UserItem/userpasswordage"
|
56
|
+
when "UserItem/homedirectory"
|
57
|
+
when "UserItem/scriptpath"
|
58
|
+
end
|
59
|
+
}
|
60
|
+
query = query + attributes.join(" and ")
|
61
|
+
users = wmi.ExecQuery(query)
|
62
|
+
users.each { | u |
|
63
|
+
return true
|
64
|
+
}
|
65
|
+
return false
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
class UserItemFactory < RubyIOC::IOCItem::IOCItemFactory
|
70
|
+
def get_type
|
71
|
+
"UserItem"
|
72
|
+
end
|
73
|
+
|
74
|
+
def create
|
75
|
+
UserItem.new
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
UserItemFactory.add_factory(UserItemFactory)
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Copyright (c) 2013 Matt Jezorek
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
4
|
+
# to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
5
|
+
# and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
#
|
7
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
#
|
9
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
11
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
12
|
+
# IN THE SOFTWARE.
|
13
|
+
module RubyIOC
|
14
|
+
module IOCItem
|
15
|
+
class VolumeItem < RubyIOC::IOCTerm
|
16
|
+
def get_type
|
17
|
+
"VolumeItem"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class VolumeItemFactory < RubyIOC::IOCItem::IOCItemFactory
|
22
|
+
def get_type
|
23
|
+
"VolumeItem"
|
24
|
+
end
|
25
|
+
|
26
|
+
def create
|
27
|
+
VolumeItem.new
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
VolumeItemFactory.add_factory(VolumeItemFactory)
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Copyright (c) 2013 Matt Jezorek
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
4
|
+
# to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
5
|
+
# and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
#
|
7
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
#
|
9
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
11
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
12
|
+
# IN THE SOFTWARE.
|
13
|
+
module RubyIOC
|
14
|
+
class IOCTerm
|
15
|
+
def get_type
|
16
|
+
nil
|
17
|
+
end
|
18
|
+
|
19
|
+
def scan(indicator = {})
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# Copyright (c) 2013 Matt Jezorek
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
4
|
+
# to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
5
|
+
# and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
#
|
7
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
#
|
9
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
11
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
12
|
+
# IN THE SOFTWARE.
|
13
|
+
require "rbconfig"
|
14
|
+
|
15
|
+
module RubyIOC
|
16
|
+
module Platform
|
17
|
+
class << self
|
18
|
+
def is?(what)
|
19
|
+
what === RbConfig::CONFIG['host_os']
|
20
|
+
end
|
21
|
+
|
22
|
+
alias is is?
|
23
|
+
|
24
|
+
def to_s
|
25
|
+
RbConfig::CONFIG['host_os']
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
module_function
|
30
|
+
|
31
|
+
def linux?
|
32
|
+
RubyIOC::Platform.is? /linux|cygwin/
|
33
|
+
end
|
34
|
+
|
35
|
+
def mac?
|
36
|
+
RubyIOC::Platform.is? /mac|darwin/
|
37
|
+
end
|
38
|
+
|
39
|
+
def bsd?
|
40
|
+
RubyIOC::Platform.is? /bsd/
|
41
|
+
end
|
42
|
+
|
43
|
+
def windows?
|
44
|
+
RubyIOC::Platform.is? /mswin|win|mingw/
|
45
|
+
end
|
46
|
+
|
47
|
+
def solaris?
|
48
|
+
RubyIOC::Platform.is? /solaris|sunos/
|
49
|
+
end
|
50
|
+
|
51
|
+
def posix?
|
52
|
+
linux? or mac? or bsd? or solaris? or Process.respond_to(:fork)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|