Add readme
parent
83c826247e
commit
d3cb774090
|
@ -2,9 +2,21 @@
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="2eef964a-b574-48e0-859a-c282c4760328" name="Default" comment="">
|
<list default="true" id="2eef964a-b574-48e0-859a-c282c4760328" name="Default" comment="">
|
||||||
|
<change type="DELETED" beforePath="$PROJECT_DIR$/old/README.md" afterPath="" />
|
||||||
|
<change type="DELETED" beforePath="$PROJECT_DIR$/old/config.lua" afterPath="" />
|
||||||
|
<change type="DELETED" beforePath="$PROJECT_DIR$/old/entry.lua" afterPath="" />
|
||||||
|
<change type="DELETED" beforePath="$PROJECT_DIR$/old/init.lua" afterPath="" />
|
||||||
|
<change type="DELETED" beforePath="$PROJECT_DIR$/old/logger.lua" afterPath="" />
|
||||||
|
<change type="DELETED" beforePath="$PROJECT_DIR$/old/waf.lua" afterPath="" />
|
||||||
|
<change type="DELETED" beforePath="$PROJECT_DIR$/old/wafconf/args" afterPath="" />
|
||||||
|
<change type="DELETED" beforePath="$PROJECT_DIR$/old/wafconf/cookie" afterPath="" />
|
||||||
|
<change type="DELETED" beforePath="$PROJECT_DIR$/old/wafconf/post" afterPath="" />
|
||||||
|
<change type="DELETED" beforePath="$PROJECT_DIR$/old/wafconf/url" afterPath="" />
|
||||||
|
<change type="DELETED" beforePath="$PROJECT_DIR$/old/wafconf/user_agent" afterPath="" />
|
||||||
|
<change type="DELETED" beforePath="$PROJECT_DIR$/old/wafconf/white_url" afterPath="" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/config.lua" afterPath="$PROJECT_DIR$/config.lua" />
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/config.lua" afterPath="$PROJECT_DIR$/config.lua" />
|
||||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/core.lua" afterPath="$PROJECT_DIR$/core.lua" />
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/core.lua" afterPath="$PROJECT_DIR$/core.lua" />
|
||||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/test.lua" afterPath="$PROJECT_DIR$/test.lua" />
|
|
||||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/test2.lua" afterPath="$PROJECT_DIR$/test2.lua" />
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/test2.lua" afterPath="$PROJECT_DIR$/test2.lua" />
|
||||||
</list>
|
</list>
|
||||||
<ignored path="ngx_lua_waf.iws" />
|
<ignored path="ngx_lua_waf.iws" />
|
||||||
|
@ -26,22 +38,38 @@
|
||||||
<favorites_list name="ngx_lua_waf" />
|
<favorites_list name="ngx_lua_waf" />
|
||||||
</component>
|
</component>
|
||||||
<component name="FileEditorManager">
|
<component name="FileEditorManager">
|
||||||
<leaf>
|
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||||
<file leaf-file-name="core.lua" pinned="false" current-in-tab="true">
|
<file leaf-file-name="core.lua" pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/core.lua">
|
<entry file="file://$PROJECT_DIR$/core.lua">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="95">
|
<state relative-caret-position="266">
|
||||||
<caret line="82" column="7" selection-start-line="82" selection-start-column="7" selection-end-line="82" selection-end-column="7" />
|
<caret line="164" column="53" selection-start-line="164" selection-start-column="51" selection-end-line="164" selection-end-column="53" />
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
|
<file leaf-file-name="README.md" pinned="false" current-in-tab="true">
|
||||||
|
<entry file="file://$PROJECT_DIR$/README.md">
|
||||||
|
<provider editor-type-id="MultiMarkdownFxPreviewEditor">
|
||||||
|
<state />
|
||||||
|
</provider>
|
||||||
|
<provider selected="true" editor-type-id="split-provider[text-editor;MultiMarkdownPreviewEditor]">
|
||||||
|
<state split_layout="FIRST">
|
||||||
|
<first_editor relative-caret-position="150">
|
||||||
|
<caret line="48" column="3" selection-start-line="48" selection-start-column="3" selection-end-line="48" selection-end-column="3" />
|
||||||
|
<folding />
|
||||||
|
</first_editor>
|
||||||
|
<second_editor />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
<file leaf-file-name="test.lua" pinned="false" current-in-tab="false">
|
<file leaf-file-name="test.lua" pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/test.lua">
|
<entry file="file://$PROJECT_DIR$/test.lua">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="16">
|
<state relative-caret-position="304">
|
||||||
<caret line="20" column="0" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
|
<caret line="16" column="2" selection-start-line="16" selection-start-column="2" selection-end-line="16" selection-end-column="2" />
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
|
@ -50,8 +78,8 @@
|
||||||
<file leaf-file-name="test2.lua" pinned="false" current-in-tab="false">
|
<file leaf-file-name="test2.lua" pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/test2.lua">
|
<entry file="file://$PROJECT_DIR$/test2.lua">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="209">
|
<state relative-caret-position="190">
|
||||||
<caret line="13" column="14" selection-start-line="13" selection-start-column="14" selection-end-line="13" selection-end-column="14" />
|
<caret line="49" column="0" selection-start-line="49" selection-start-column="0" selection-end-line="49" selection-end-column="0" />
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
|
@ -60,8 +88,8 @@
|
||||||
<file leaf-file-name="config.lua" pinned="false" current-in-tab="false">
|
<file leaf-file-name="config.lua" pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/config.lua">
|
<entry file="file://$PROJECT_DIR$/config.lua">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="361">
|
<state relative-caret-position="34">
|
||||||
<caret line="19" column="11" selection-start-line="19" selection-start-column="11" selection-end-line="19" selection-end-column="11" />
|
<caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
|
@ -70,8 +98,8 @@
|
||||||
<file leaf-file-name="iputils.lua" pinned="false" current-in-tab="false">
|
<file leaf-file-name="iputils.lua" pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/iputils.lua">
|
<entry file="file://$PROJECT_DIR$/iputils.lua">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="285">
|
<state relative-caret-position="152">
|
||||||
<caret line="184" column="13" selection-start-line="184" selection-start-column="13" selection-end-line="184" selection-end-column="13" />
|
<caret line="175" column="6" selection-start-line="175" selection-start-column="6" selection-end-line="175" selection-end-column="6" />
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
|
@ -96,10 +124,11 @@
|
||||||
<option name="CHANGED_PATHS">
|
<option name="CHANGED_PATHS">
|
||||||
<list>
|
<list>
|
||||||
<option value="$PROJECT_DIR$/init.lua" />
|
<option value="$PROJECT_DIR$/init.lua" />
|
||||||
<option value="$PROJECT_DIR$/config.lua" />
|
|
||||||
<option value="$PROJECT_DIR$/test.lua" />
|
<option value="$PROJECT_DIR$/test.lua" />
|
||||||
<option value="$PROJECT_DIR$/test2.lua" />
|
<option value="$PROJECT_DIR$/test2.lua" />
|
||||||
<option value="$PROJECT_DIR$/core.lua" />
|
<option value="$PROJECT_DIR$/core.lua" />
|
||||||
|
<option value="$PROJECT_DIR$/config.lua" />
|
||||||
|
<option value="$PROJECT_DIR$/README.md" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
@ -110,10 +139,10 @@
|
||||||
<sorting>DEFINITION_ORDER</sorting>
|
<sorting>DEFINITION_ORDER</sorting>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectFrameBounds">
|
<component name="ProjectFrameBounds">
|
||||||
<option name="x" value="8" />
|
<option name="x" value="13" />
|
||||||
<option name="y" value="24" />
|
<option name="y" value="32" />
|
||||||
<option name="width" value="1260" />
|
<option name="width" value="1151" />
|
||||||
<option name="height" value="709" />
|
<option name="height" value="650" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||||
<OptionsSetting value="true" id="Add" />
|
<OptionsSetting value="true" id="Add" />
|
||||||
|
@ -276,6 +305,12 @@
|
||||||
<method />
|
<method />
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
|
<configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
|
||||||
|
<node-interpreter>project</node-interpreter>
|
||||||
|
<node-options />
|
||||||
|
<gulpfile />
|
||||||
|
<tasks />
|
||||||
|
<arguments />
|
||||||
|
<envs />
|
||||||
<method />
|
<method />
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration default="true" type="js.build_tools.npm" factoryName="npm">
|
<configuration default="true" type="js.build_tools.npm" factoryName="npm">
|
||||||
|
@ -421,27 +456,27 @@
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="ToolWindowManager">
|
<component name="ToolWindowManager">
|
||||||
<frame x="8" y="24" width="1260" height="709" extended-state="0" />
|
<frame x="13" y="32" width="1151" height="650" extended-state="0" />
|
||||||
<editor active="true" />
|
<editor active="true" />
|
||||||
<layout>
|
<layout>
|
||||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24958949" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.22272317" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="LuaJ" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
<window_info id="LuaJ" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
|
||||||
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.06482982" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.27598566" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
||||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
|
||||||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
|
||||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
||||||
|
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
||||||
|
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||||
</layout>
|
</layout>
|
||||||
</component>
|
</component>
|
||||||
|
@ -461,7 +496,7 @@
|
||||||
<watches-manager />
|
<watches-manager />
|
||||||
</component>
|
</component>
|
||||||
<component name="editorHistoryManager">
|
<component name="editorHistoryManager">
|
||||||
<entry file="file://$PROJECT_DIR$/logger.lua">
|
<entry file="file://$PROJECT_DIR$/core.lua">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="0">
|
<state relative-caret-position="0">
|
||||||
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||||
|
@ -469,18 +504,34 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/entry.lua">
|
<entry file="file://$PROJECT_DIR$/test.lua">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="304">
|
<state relative-caret-position="380">
|
||||||
<caret line="16" column="0" selection-start-line="16" selection-start-column="0" selection-end-line="16" selection-end-column="0" />
|
<caret line="20" column="0" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/init.lua">
|
<entry file="file://$PROJECT_DIR$/test2.lua">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="247">
|
<state relative-caret-position="247">
|
||||||
<caret line="212" column="24" selection-start-line="212" selection-start-column="24" selection-end-line="212" selection-end-column="24" />
|
<caret line="13" column="14" selection-start-line="13" selection-start-column="14" selection-end-line="13" selection-end-column="14" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/config.lua">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="323">
|
||||||
|
<caret line="17" column="24" selection-start-line="17" selection-start-column="24" selection-end-line="17" selection-end-column="24" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/iputils.lua">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="3496">
|
||||||
|
<caret line="184" column="13" selection-start-line="184" selection-start-column="13" selection-end-line="184" selection-end-column="13" />
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
|
@ -493,45 +544,166 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/iputils.lua">
|
<entry file="file://$PROJECT_DIR$/core.lua">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="285">
|
<state relative-caret-position="1406">
|
||||||
<caret line="184" column="13" selection-start-line="184" selection-start-column="13" selection-end-line="184" selection-end-column="13" />
|
<caret line="74" column="31" selection-start-line="74" selection-start-column="31" selection-end-line="74" selection-end-column="31" />
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/config.lua">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="361">
|
|
||||||
<caret line="19" column="11" selection-start-line="19" selection-start-column="11" selection-end-line="19" selection-end-column="11" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/test2.lua">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="209">
|
|
||||||
<caret line="13" column="14" selection-start-line="13" selection-start-column="14" selection-end-line="13" selection-end-column="14" />
|
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/test.lua">
|
<entry file="file://$PROJECT_DIR$/test.lua">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="16">
|
<state relative-caret-position="380">
|
||||||
<caret line="20" column="0" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
|
<caret line="20" column="0" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/test2.lua">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="247">
|
||||||
|
<caret line="13" column="14" selection-start-line="13" selection-start-column="14" selection-end-line="13" selection-end-column="14" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/config.lua">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="323">
|
||||||
|
<caret line="17" column="24" selection-start-line="17" selection-start-column="24" selection-end-line="17" selection-end-column="24" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/iputils.lua">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="3496">
|
||||||
|
<caret line="184" column="13" selection-start-line="184" selection-start-column="13" selection-end-line="184" selection-end-column="13" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/.gitattributes">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="0">
|
||||||
|
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/core.lua">
|
<entry file="file://$PROJECT_DIR$/core.lua">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="95">
|
<state relative-caret-position="0">
|
||||||
<caret line="82" column="7" selection-start-line="82" selection-start-column="7" selection-end-line="82" selection-end-column="7" />
|
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/test.lua">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="380">
|
||||||
|
<caret line="20" column="0" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/test2.lua">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="247">
|
||||||
|
<caret line="13" column="14" selection-start-line="13" selection-start-column="14" selection-end-line="13" selection-end-column="14" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/config.lua">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="323">
|
||||||
|
<caret line="17" column="24" selection-start-line="17" selection-start-column="24" selection-end-line="17" selection-end-column="24" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/iputils.lua">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="3496">
|
||||||
|
<caret line="184" column="13" selection-start-line="184" selection-start-column="13" selection-end-line="184" selection-end-column="13" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/.gitattributes">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="0">
|
||||||
|
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/logger.lua" />
|
||||||
|
<entry file="file://$PROJECT_DIR$/entry.lua" />
|
||||||
|
<entry file="file://$PROJECT_DIR$/init.lua" />
|
||||||
|
<entry file="file://$PROJECT_DIR$/.gitattributes">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="0">
|
||||||
|
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/test.lua">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="304">
|
||||||
|
<caret line="16" column="2" selection-start-line="16" selection-start-column="2" selection-end-line="16" selection-end-column="2" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/iputils.lua">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="152">
|
||||||
|
<caret line="175" column="6" selection-start-line="175" selection-start-column="6" selection-end-line="175" selection-end-column="6" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/test2.lua">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="190">
|
||||||
|
<caret line="49" column="0" selection-start-line="49" selection-start-column="0" selection-end-line="49" selection-end-column="0" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/config.lua">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="34">
|
||||||
|
<caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/core.lua">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="266">
|
||||||
|
<caret line="164" column="53" selection-start-line="164" selection-start-column="51" selection-end-line="164" selection-end-column="53" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/README.md">
|
||||||
|
<provider editor-type-id="MultiMarkdownFxPreviewEditor">
|
||||||
|
<state />
|
||||||
|
</provider>
|
||||||
|
<provider selected="true" editor-type-id="split-provider[text-editor;MultiMarkdownPreviewEditor]">
|
||||||
|
<state split_layout="FIRST">
|
||||||
|
<first_editor relative-caret-position="150">
|
||||||
|
<caret line="48" column="3" selection-start-line="48" selection-start-column="3" selection-end-line="48" selection-end-column="3" />
|
||||||
|
<folding />
|
||||||
|
</first_editor>
|
||||||
|
<second_editor />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -0,0 +1,56 @@
|
||||||
|
### nginx lua waf
|
||||||
|
|
||||||
|
##### 参考
|
||||||
|
1. https://github.com/loveshell/ngx_lua_waf
|
||||||
|
2. https://github.com/p0pr0ck5/lua-resty-waf
|
||||||
|
|
||||||
|
|
||||||
|
#### 使用
|
||||||
|
1. 安装Nginx和lua插件 或者直接安装 openresty
|
||||||
|
2. git clone
|
||||||
|
3. nginx.conf 配置文件
|
||||||
|
http段
|
||||||
|
...
|
||||||
|
|
||||||
|
lua_package_path "/data/server/nginx/conf/waf/?.lua";
|
||||||
|
lua_shared_dict limit 10m;
|
||||||
|
...
|
||||||
|
|
||||||
|
4. 在location中使用
|
||||||
|
|
||||||
|
location / {
|
||||||
|
access_by_lua '
|
||||||
|
local lua_waf = require "core"
|
||||||
|
local waf = lua_waf:new("default")
|
||||||
|
waf:set_option("cc_rate", "2/60")
|
||||||
|
waf:set_option("active", true)
|
||||||
|
waf:set_option("white_ip_list", {"192.168.128.0/24", "127.0.0.1"})
|
||||||
|
waf:run()
|
||||||
|
';
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
5. reload
|
||||||
|
|
||||||
|
#### 说明
|
||||||
|
— 默认配置文件
|
||||||
|
|
||||||
|
_M.defaults = {
|
||||||
|
active = false,
|
||||||
|
cc_deny = true,
|
||||||
|
cc_rate = "100/600",
|
||||||
|
cc_deny_seconds = 600,
|
||||||
|
cc_deny_code = 404,
|
||||||
|
log_path = "/tmp/nginx_waf.log",
|
||||||
|
white_ip_list = {},
|
||||||
|
black_ip_list = {},
|
||||||
|
black_return_code = 403,
|
||||||
|
}
|
||||||
|
|
||||||
|
- 单独设置
|
||||||
|
|
||||||
|
waf:set_option("cc_rate", "2/60")
|
||||||
|
|
||||||
|
- 问题排查
|
||||||
|
nginx error日志 和 log_path
|
||||||
|
|
|
@ -11,7 +11,6 @@ _M.version = '0.1.0'
|
||||||
|
|
||||||
|
|
||||||
_M.defaults = {
|
_M.defaults = {
|
||||||
debug = true,
|
|
||||||
active = false,
|
active = false,
|
||||||
cc_deny = true,
|
cc_deny = true,
|
||||||
cc_rate = "100/600",
|
cc_rate = "100/600",
|
||||||
|
|
39
core.lua
39
core.lua
|
@ -15,6 +15,7 @@ local config = require "config"
|
||||||
local iputils = require "iputils"
|
local iputils = require "iputils"
|
||||||
local mt = {__index=_M }
|
local mt = {__index=_M }
|
||||||
local limit = ngx.shared.limit
|
local limit = ngx.shared.limit
|
||||||
|
local _cidr_cache = {}
|
||||||
|
|
||||||
local function get_client_ip()
|
local function get_client_ip()
|
||||||
local ip = get_headers()["X-Real-IP"]
|
local ip = get_headers()["X-Real-IP"]
|
||||||
|
@ -71,11 +72,11 @@ function _M.deny_cc(self)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
elseif req == max_visit then
|
elseif req == max_visit then
|
||||||
|
self:log("[Deny_cc] Block "..token)
|
||||||
|
limit:incr(token, 1)
|
||||||
if self.config.active then
|
if self.config.active then
|
||||||
ngx.exit(self.config.cc_deny_code)
|
ngx.exit(self.config.cc_deny_code)
|
||||||
end
|
end
|
||||||
self:log("[Deny_cc] Block "..token)
|
|
||||||
limit:incr(token, 1)
|
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
limit:incr(token, 1)
|
limit:incr(token, 1)
|
||||||
|
@ -85,6 +86,32 @@ function _M.deny_cc(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function cidr_match(ip, cidr_pattern)
|
||||||
|
local t = {}
|
||||||
|
local n = 1
|
||||||
|
|
||||||
|
if (type(cidr_pattern) ~= "table") then
|
||||||
|
cidr_pattern = { cidr_pattern }
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, v in ipairs(cidr_pattern) do
|
||||||
|
-- try to grab the parsed cidr from out module cache
|
||||||
|
local cidr = _cidr_cache[v]
|
||||||
|
|
||||||
|
-- if it wasn't there, compute and cache the value
|
||||||
|
if (not cidr) then
|
||||||
|
local lower, upper = iputils.parse_cidr(v)
|
||||||
|
cidr = { lower, upper }
|
||||||
|
_cidr_cache[v] = cidr
|
||||||
|
end
|
||||||
|
|
||||||
|
t[n] = cidr
|
||||||
|
n = n + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
return iputils.ip_in_cidrs(ip, t), ip
|
||||||
|
end
|
||||||
|
|
||||||
function _M.log(self, msg)
|
function _M.log(self, msg)
|
||||||
ngx.log(ngx.WARN, self.config.log_path)
|
ngx.log(ngx.WARN, self.config.log_path)
|
||||||
if log_inited[self.config.log_path] == nil then
|
if log_inited[self.config.log_path] == nil then
|
||||||
|
@ -110,14 +137,12 @@ function _M.in_white_ip_list(self)
|
||||||
|
|
||||||
local white_ip_list = self.config.white_ip_list
|
local white_ip_list = self.config.white_ip_list
|
||||||
if next(white_ip_list) ~= nil then
|
if next(white_ip_list) ~= nil then
|
||||||
for _, wip in pairs(white_ip_list) do
|
if cidr_match(ip, white_ip_list) then
|
||||||
if ip == wip or iputils.ip_in_cidrs(ip, wip) then
|
|
||||||
limit:set(white_ip_token, true, 3600)
|
limit:set(white_ip_token, true, 3600)
|
||||||
self:log("[White_ip] In white list passed: "..ip)
|
self:log("[White_ip] In white list passed: "..ip)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -135,8 +160,7 @@ function _M.in_black_ip_list(self)
|
||||||
|
|
||||||
local black_ip_list = self.config.black_ip_list
|
local black_ip_list = self.config.black_ip_list
|
||||||
if next(black_ip_list) ~= nil then
|
if next(black_ip_list) ~= nil then
|
||||||
for _, bip in pairs(black_ip_list) do
|
if cidr_match(ip, black_ip_list) then
|
||||||
if ip == bip or iputils.ip_in_cidrs(ip, bip) then
|
|
||||||
limit:set(block_ip_token, true, 3600)
|
limit:set(block_ip_token, true, 3600)
|
||||||
self:log("[Black_ip] In black list denied: "..ip)
|
self:log("[Black_ip] In black list denied: "..ip)
|
||||||
if self.config.active then
|
if self.config.active then
|
||||||
|
@ -145,7 +169,6 @@ function _M.in_black_ip_list(self)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
return false
|
return false
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
## ngx_lua_waf
|
|
||||||
基于 loveshell [nginx-lua-waf](https://github.com/loveshell/ngx_lua_waf)更改
|
|
||||||
|
|
||||||
### 使用方法:
|
|
||||||
1. nginx安装lua模块,不再详述
|
|
||||||
2. 下载模块
|
|
||||||
cd /data/server/nginx/conf
|
|
||||||
git clone https://github.com/ibuler/ngx_lua_waf.git waf
|
|
||||||
2. nginx.conf 添加参数
|
|
||||||
lua_package_path /data/server/nginx/conf/waf/?.lua; # 模块位置
|
|
||||||
lua_shared_dict limit 10m; # 设置lua使用内存, 根据访问量设置合适值
|
|
||||||
3. location或server设置访问控制
|
|
||||||
access_by_lua_file /data/server/nginx/conf/waf/entry.lua; # 可以copy一份到不同的配置中,单独修改其配置文件
|
|
||||||
|
|
||||||
## 文件说明
|
|
||||||
- config.lua 默认配置文件
|
|
||||||
- entry.lua access控制入口样例文件
|
|
||||||
- init.lua 函数所在文件,都会调用该文件
|
|
||||||
- wafconf 暂时没有使用,将来开发继续完成
|
|
||||||
|
|
||||||
|
|
||||||
### 参数说明
|
|
||||||
- debug: 调试阶段开始debug,显示debug信息
|
|
||||||
- cc_deny: 开启cc_deny,控制访问量
|
|
||||||
- cc_rate: 10/60 意思为 60s内访问10次,超过频率会被block掉
|
|
||||||
- cc_deny_seconds: 达到阈值后,禁止访问的时间
|
|
||||||
|
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
debug = false
|
|
||||||
-- rule_path = "/data/server/nginx/conf/waf/wafconf/"
|
|
||||||
-- url_check = false
|
|
||||||
-- url_write_check = false
|
|
||||||
-- args_check = false
|
|
||||||
-- ua_check = false
|
|
||||||
-- ua_write_check = false
|
|
||||||
-- cookie_check = false
|
|
||||||
-- post_check = false
|
|
||||||
|
|
||||||
-- black_file_ext = {"php", "jsp"}
|
|
||||||
-- attack_log = false
|
|
||||||
-- attach_log_dir = "/data/logs/waf/"
|
|
||||||
|
|
||||||
-- redirect = false
|
|
||||||
-- redirect_url = "http://www.baidu.com"
|
|
||||||
ip_check = false
|
|
||||||
ip_white_list = {} -- {'192.168.1.*', '127.0.0.1'}
|
|
||||||
ip_black_list = {} -- {'0.0.0.0', '106.2.34.29'}
|
|
||||||
|
|
||||||
cc_deny = false
|
|
||||||
cc_rate = "100/60"
|
|
||||||
cc_deny_seconds = "600"
|
|
|
@ -1,16 +0,0 @@
|
||||||
--------- Global default config -------
|
|
||||||
require 'config'
|
|
||||||
--------- Local config setting --------
|
|
||||||
debug = true
|
|
||||||
|
|
||||||
cc_deny = false
|
|
||||||
cc_rate = '10/60'
|
|
||||||
ip_check = true
|
|
||||||
ip_white_list = {}
|
|
||||||
ip_black_list = {}
|
|
||||||
|
|
||||||
--------- Access control limit --------
|
|
||||||
if ip_check and (whiteIP(ip_white_list, debug) or blackIP(ip_black_list, debug)) then
|
|
||||||
elseif cc_deny and denyCC(cc_rate, cc_deny_seconds, debug) then
|
|
||||||
else return
|
|
||||||
end
|
|
313
old/init.lua
313
old/init.lua
|
@ -1,313 +0,0 @@
|
||||||
local match = string.match
|
|
||||||
local ngx_match = ngx.re.match
|
|
||||||
local unescape = ngx.unescape_uri
|
|
||||||
local get_headers = ngx.req.get_headers
|
|
||||||
|
|
||||||
function getClientIp()
|
|
||||||
IP = get_headers()["X-Real-IP"]
|
|
||||||
if IP == nil then
|
|
||||||
IP = ngx.var.remote_addr
|
|
||||||
end
|
|
||||||
if IP == nil then
|
|
||||||
IP = "unknown"
|
|
||||||
end
|
|
||||||
return IP
|
|
||||||
end
|
|
||||||
|
|
||||||
function write(logfile, msg)
|
|
||||||
local fd = io.open(logfile, "ab")
|
|
||||||
if fd == nil then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
fd:write(msg)
|
|
||||||
fd:flush()
|
|
||||||
fd:close()
|
|
||||||
end
|
|
||||||
|
|
||||||
function log(method, url, data, tag)
|
|
||||||
if attack_log then
|
|
||||||
local realIp = getClientIp()
|
|
||||||
local ua = ngx.var.http_user_agent
|
|
||||||
local servername = ngx.var.server_name
|
|
||||||
local time = ngx.localtime()
|
|
||||||
if ua then
|
|
||||||
line = realIp.." ["..time.."] \""..method.." "..servername..url.."\" \""..data.."\" \""..ua.."\" \""..tag.."\"\n"
|
|
||||||
else
|
|
||||||
line = realIp.." ["..time.."] \""..method.." "..servername..url.."\" \""..data.."\" - \""..tag.."\"\n"
|
|
||||||
end
|
|
||||||
local filename = logpath..'/'..servername.."_"..ngx.today().."_sec.log"
|
|
||||||
write(filename, line)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
------------------------------------ 规则读取函数 -----------------------------------------
|
|
||||||
-- function readRule(var)
|
|
||||||
-- file = io.open(rule_path..'/'..var, "r")
|
|
||||||
-- if file == nil then
|
|
||||||
-- return
|
|
||||||
-- end
|
|
||||||
-- t = {}
|
|
||||||
-- for line in file:lines() do
|
|
||||||
-- table.insert(t, line)
|
|
||||||
-- end
|
|
||||||
-- file:close()
|
|
||||||
-- return(t)
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- url_rules = readRule('url')
|
|
||||||
-- white_url_rules = readRule('white_url')
|
|
||||||
-- args_rules = readRule('args')
|
|
||||||
-- ua_rules = readRule('user_agent')
|
|
||||||
-- post_rules = readRule('post')
|
|
||||||
-- cookie_rules = readRule('cookie')
|
|
||||||
|
|
||||||
|
|
||||||
function debugSay(msg, debug)
|
|
||||||
if debug then
|
|
||||||
ngx.header.content_type = "text/html"
|
|
||||||
ngx.status = ngx.HTTP_FORBIDDEN
|
|
||||||
ngx.say(msg)
|
|
||||||
ngx.exit(ngx.status)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- function whiteURLCheck()
|
|
||||||
-- if white_url_rules ~= nil then
|
|
||||||
-- for _, rule in pairs(white_url_rules) do
|
|
||||||
-- if ngx_match(ngx.var.uri, rule, "isjo") then
|
|
||||||
-- return true
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- return false
|
|
||||||
-- end
|
|
||||||
|
|
||||||
|
|
||||||
-- function fileExtCheck(ext, black_file_ext)
|
|
||||||
-- local items = Set(black_fileExt)
|
|
||||||
-- ext = string.lower(ext)
|
|
||||||
-- if ext then
|
|
||||||
-- for rule in pairs(items) do
|
|
||||||
-- if ngx.re.match(ext, rule, "isjo") then
|
|
||||||
-- if attack_log then
|
|
||||||
-- log('POST',ngx.var.request_uri,"-","file attack with ext "..ext)
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- if debug then
|
|
||||||
-- debugSay(ngx.var.request_uri.."-".."file attack with ext: "..ext)
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- return false
|
|
||||||
-- end
|
|
||||||
|
|
||||||
|
|
||||||
-- function set(list)
|
|
||||||
-- local set = {}
|
|
||||||
-- for _, l in ipairs(list) do
|
|
||||||
-- set[l] = true
|
|
||||||
-- end
|
|
||||||
-- return set
|
|
||||||
-- end
|
|
||||||
|
|
||||||
|
|
||||||
-- function checkArgs()
|
|
||||||
-- for _, rule in pairs(args_rules) do
|
|
||||||
-- local args = ngx.req.get_uri_args()
|
|
||||||
-- for key, val in pairs(args) do
|
|
||||||
-- if type(val) == 'table' then
|
|
||||||
-- if val ~= false then
|
|
||||||
-- data = table.concat(val, " ")
|
|
||||||
-- end
|
|
||||||
-- else
|
|
||||||
-- data = val
|
|
||||||
-- end
|
|
||||||
-- if data and type(data) ~= "boolean" and rule ~="" and ngx_match(unescape(data), rule, "isjo") then
|
|
||||||
-- log('GET', ngx.var.request_uri, "-", rule)
|
|
||||||
-- debugSay(ngx.var.request_uri.."-"..rule)
|
|
||||||
-- return true
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- return false
|
|
||||||
-- end
|
|
||||||
|
|
||||||
|
|
||||||
-- function url()
|
|
||||||
-- if UrlDeny then
|
|
||||||
-- for _,rule in pairs(urlrules) do
|
|
||||||
-- if rule ~="" and ngxmatch(ngx.var.request_uri,rule,"isjo") then
|
|
||||||
-- log('GET',ngx.var.request_uri,"-",rule)
|
|
||||||
-- say_html()
|
|
||||||
-- return true
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- return false
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- function ua()
|
|
||||||
-- local ua = ngx.var.http_user_agent
|
|
||||||
-- if ua ~= nil then
|
|
||||||
-- for _,rule in pairs(uarules) do
|
|
||||||
-- if rule ~="" and ngxmatch(ua,rule,"isjo") then
|
|
||||||
-- log('UA',ngx.var.request_uri,"-",rule)
|
|
||||||
-- say_html()
|
|
||||||
-- return true
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- return false
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- function body(data)
|
|
||||||
-- for _,rule in pairs(postrules) do
|
|
||||||
-- if rule ~="" and data~="" and ngxmatch(unescape(data),rule,"isjo") then
|
|
||||||
-- log('POST',ngx.var.request_uri,data,rule)
|
|
||||||
-- say_html()
|
|
||||||
-- return true
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- return false
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- function cookie()
|
|
||||||
-- local ck = ngx.var.http_cookie
|
|
||||||
-- if CookieCheck and ck then
|
|
||||||
-- for _,rule in pairs(ckrules) do
|
|
||||||
-- if rule ~="" and ngxmatch(ck,rule,"isjo") then
|
|
||||||
-- log('Cookie',ngx.var.request_uri,"-",rule)
|
|
||||||
-- say_html()
|
|
||||||
-- return true
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- return false
|
|
||||||
-- end
|
|
||||||
|
|
||||||
function denyCC(cc_rate, cc_deny_seconds, debug)
|
|
||||||
local uri = ngx.var.uri
|
|
||||||
cc_count = tonumber(string.match(cc_rate, '(.*)/'))
|
|
||||||
cc_seconds = tonumber(string.match(cc_rate, '/(.*)'))
|
|
||||||
local token = getClientIp()..uri
|
|
||||||
local limit = ngx.shared.limit
|
|
||||||
local req, _ = limit:get(token) -- 127.0.0.1_/price/v1.0: 10
|
|
||||||
local ip = getClientIp()
|
|
||||||
local block, _ = limit:get(ip) -- 127.0.0.1: 1
|
|
||||||
|
|
||||||
if block then
|
|
||||||
if debug then
|
|
||||||
ngx.say('Deny by waf.')
|
|
||||||
ngx.exit('200')
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
ngx.exit(404)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if req then
|
|
||||||
if req > cc_count then
|
|
||||||
limit:set(ip, 1, cc_deny_seconds)
|
|
||||||
ngx.exit(404)
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
limit:incr(token, 1)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
limit:set(token, 1, cc_seconds)
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
-- function get_boundary()
|
|
||||||
-- local header = get_headers()["content-type"]
|
|
||||||
-- if not header then
|
|
||||||
-- return nil
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- if type(header) == "table" then
|
|
||||||
-- header = header[1]
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- local m = match(header, ";%s*boundary=\"([^\"]+)\"")
|
|
||||||
-- if m then
|
|
||||||
-- return m
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- return match(header, ";%s*boundary=([^\",;]+)")
|
|
||||||
-- end
|
|
||||||
|
|
||||||
function string.split(str, delimiter)
|
|
||||||
if str==nil or str=='' or delimiter==nil then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local result = {}
|
|
||||||
for match in (str..delimiter):gmatch("(.-)"..delimiter) do
|
|
||||||
table.insert(result, match)
|
|
||||||
end
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function innet(ip, network)
|
|
||||||
local star = ''
|
|
||||||
for i in string.gmatch(network, '%*') do
|
|
||||||
star = star..i
|
|
||||||
end
|
|
||||||
|
|
||||||
local ip = string.split(ip, '%.')
|
|
||||||
local network = string.split(network, '%.')
|
|
||||||
if ip == nil or network == nil then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
local ip_prefix = {}
|
|
||||||
local network_prefix = {}
|
|
||||||
for i=1, 4-string.len(star) do
|
|
||||||
ip_prefix[i] = ip[i]
|
|
||||||
network_prefix[i] = network[i]
|
|
||||||
end
|
|
||||||
|
|
||||||
ip_prefix = table.concat(ip_prefix, '.')
|
|
||||||
network_prefix = table.concat(network_prefix, '.')
|
|
||||||
|
|
||||||
if ip_prefix == network_prefix then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function whiteIP(ip_white_list, debug)
|
|
||||||
if next(ip_white_list) ~= nil then
|
|
||||||
ip = getClientIp()
|
|
||||||
for _, wip in pairs(ip_white_list) do
|
|
||||||
if ip == wip or innet(ip, wip) then
|
|
||||||
if debug then
|
|
||||||
ngx.say(ip.." in white list <br />")
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
function blackIP(ip_black_list, debug)
|
|
||||||
if next(ip_black_list) ~= nil then
|
|
||||||
ip = getClientIp()
|
|
||||||
for _, bip in pairs(ip_black_list) do
|
|
||||||
if ip == bip or ip == "0.0.0.0" or innet(ip, bip) then
|
|
||||||
if debug then
|
|
||||||
ngx.say(ip.." in black list <br/>")
|
|
||||||
end
|
|
||||||
ngx.exit(403)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
|
@ -1,22 +0,0 @@
|
||||||
\.\./
|
|
||||||
\:\$
|
|
||||||
\$\{
|
|
||||||
select.+(from|limit)
|
|
||||||
(?:(union(.*?)select))
|
|
||||||
having|rongjitest
|
|
||||||
sleep\((\s*)(\d*)(\s*)\)
|
|
||||||
benchmark\((.*)\,(.*)\)
|
|
||||||
base64_decode\(
|
|
||||||
(?:from\W+information_schema\W)
|
|
||||||
(?:(?:current_)user|database|schema|connection_id)\s*\(
|
|
||||||
(?:etc\/\W*passwd)
|
|
||||||
into(\s+)+(?:dump|out)file\s*
|
|
||||||
group\s+by.+\(
|
|
||||||
xwork.MethodAccessor
|
|
||||||
(?:define|eval|file_get_contents|include|require|require_once|shell_exec|phpinfo|system|passthru|preg_\w+|execute|echo|print|print_r|var_dump|(fp)open|alert|showmodaldialog)\(
|
|
||||||
xwork\.MethodAccessor
|
|
||||||
(gopher|doc|php|glob|file|phar|zlib|ftp|ldap|dict|ogg|data)\:\/
|
|
||||||
java\.lang
|
|
||||||
\$_(GET|post|cookie|files|session|env|phplib|GLOBALS|SERVER)\[
|
|
||||||
\<(iframe|script|body|img|layer|div|meta|style|base|object|input)
|
|
||||||
(onmouseover|onerror|onload)\=
|
|
|
@ -1,20 +0,0 @@
|
||||||
\.\./
|
|
||||||
\:\$
|
|
||||||
\$\{
|
|
||||||
select.+(from|limit)
|
|
||||||
(?:(union(.*?)select))
|
|
||||||
having|rongjitest
|
|
||||||
sleep\((\s*)(\d*)(\s*)\)
|
|
||||||
benchmark\((.*)\,(.*)\)
|
|
||||||
base64_decode\(
|
|
||||||
(?:from\W+information_schema\W)
|
|
||||||
(?:(?:current_)user|database|schema|connection_id)\s*\(
|
|
||||||
(?:etc\/\W*passwd)
|
|
||||||
into(\s+)+(?:dump|out)file\s*
|
|
||||||
group\s+by.+\(
|
|
||||||
xwork.MethodAccessor
|
|
||||||
(?:define|eval|file_get_contents|include|require|require_once|shell_exec|phpinfo|system|passthru|preg_\w+|execute|echo|print|print_r|var_dump|(fp)open|alert|showmodaldialog)\(
|
|
||||||
xwork\.MethodAccessor
|
|
||||||
(gopher|doc|php|glob|file|phar|zlib|ftp|ldap|dict|ogg|data)\:\/
|
|
||||||
java\.lang
|
|
||||||
\$_(GET|post|cookie|files|session|env|phplib|GLOBALS|SERVER)\[
|
|
|
@ -1,19 +0,0 @@
|
||||||
select.+(from|limit)
|
|
||||||
(?:(union(.*?)select))
|
|
||||||
having|rongjitest
|
|
||||||
sleep\((\s*)(\d*)(\s*)\)
|
|
||||||
benchmark\((.*)\,(.*)\)
|
|
||||||
base64_decode\(
|
|
||||||
(?:from\W+information_schema\W)
|
|
||||||
(?:(?:current_)user|database|schema|connection_id)\s*\(
|
|
||||||
(?:etc\/\W*passwd)
|
|
||||||
into(\s+)+(?:dump|out)file\s*
|
|
||||||
group\s+by.+\(
|
|
||||||
xwork.MethodAccessor
|
|
||||||
(?:define|eval|file_get_contents|include|require|require_once|shell_exec|phpinfo|system|passthru|preg_\w+|execute|echo|print|print_r|var_dump|(fp)open|alert|showmodaldialog)\(
|
|
||||||
xwork\.MethodAccessor
|
|
||||||
(gopher|doc|php|glob|file|phar|zlib|ftp|ldap|dict|ogg|data)\:\/
|
|
||||||
java\.lang
|
|
||||||
\$_(GET|post|cookie|files|session|env|phplib|GLOBALS|SERVER)\[
|
|
||||||
\<(iframe|script|body|img|layer|div|meta|style|base|object|input)
|
|
||||||
(onmouseover|onerror|onload)\=
|
|
|
@ -1,6 +0,0 @@
|
||||||
\.(svn|htaccess|bash_history|git)
|
|
||||||
\.(bak|inc|old|mdb|sql|backup|java|class)$
|
|
||||||
(vhost|bbs|host|wwwroot|www|site|root|hytop|flashfxp).*\.rar
|
|
||||||
(phpmyadmin|jmx-console|jmxinvokerservlet)
|
|
||||||
java\.lang
|
|
||||||
/(attachments|upimg|images|css|uploadfiles|html|uploads|templets|static|template|data|inc|forumdata|upload|includes|cache|avatar)/(\\w+).(php|jsp)
|
|
|
@ -1 +0,0 @@
|
||||||
(HTTrack|harvest|audit|dirbuster|pangolin|nmap|sqln|-scan|hydra|Parser|libwww|BBBike|sqlmap|w3af|owasp|Nikto|fimap|havij|PycURL|zmeu|BabyKrokodil|netsparker|httperf|bench| SF/)
|
|
|
@ -1 +0,0 @@
|
||||||
^/123/$
|
|
36
test2.lua
36
test2.lua
|
@ -10,8 +10,44 @@
|
||||||
--local lua_waf = require "core"
|
--local lua_waf = require "core"
|
||||||
local lua_waf = require "test"
|
local lua_waf = require "test"
|
||||||
local waf = lua_waf:new("test")
|
local waf = lua_waf:new("test")
|
||||||
|
local _cidr_cache = {}
|
||||||
|
|
||||||
print(waf.name)
|
print(waf.name)
|
||||||
|
local iputils = require "iputils"
|
||||||
|
|
||||||
|
function cidr_match(ip, cidr_pattern)
|
||||||
|
local t = {}
|
||||||
|
local n = 1
|
||||||
|
|
||||||
|
if (type(cidr_pattern) ~= "table") then
|
||||||
|
cidr_pattern = { cidr_pattern }
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, v in ipairs(cidr_pattern) do
|
||||||
|
-- try to grab the parsed cidr from out module cache
|
||||||
|
local cidr = _cidr_cache[v]
|
||||||
|
|
||||||
|
-- if it wasn't there, compute and cache the value
|
||||||
|
if (not cidr) then
|
||||||
|
local lower, upper = iputils.parse_cidr(v)
|
||||||
|
cidr = { lower, upper }
|
||||||
|
_cidr_cache[v] = cidr
|
||||||
|
end
|
||||||
|
|
||||||
|
t[n] = cidr
|
||||||
|
n = n + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
return iputils.ip_in_cidrs(ip, t), ip
|
||||||
|
end
|
||||||
|
|
||||||
|
a = cidr_match('192.168.128.230', {'192.168.128.0/24', '127.0.0.1'})
|
||||||
|
|
||||||
|
print(a)
|
||||||
|
|
||||||
|
a = cidr_match('172.16.1.1', {'172.16.1.2'})
|
||||||
|
print(a)
|
||||||
|
|
||||||
--for k, v in pairs(waf["config"]) do
|
--for k, v in pairs(waf["config"]) do
|
||||||
-- print(k, v)
|
-- print(k, v)
|
||||||
--end
|
--end
|
||||||
|
|
Loading…
Reference in New Issue