@@ -4,9 +4,7 @@ use tokio;
4
4
5
5
use ratatui:: {
6
6
backend:: CrosstermBackend ,
7
- layout:: { Alignment , Constraint , Direction , Layout } ,
8
- style:: { Color , Style } ,
9
- widgets:: { Block , Borders , Paragraph , Wrap } ,
7
+ layout:: { Constraint , Direction , Layout } ,
10
8
Terminal ,
11
9
} ;
12
10
@@ -19,7 +17,10 @@ use crossterm::{
19
17
use std:: io:: stdout;
20
18
21
19
mod response;
20
+ mod block;
21
+
22
22
use response:: validation_exist_sql_injection;
23
+ use block:: * ;
23
24
24
25
#[ tokio:: main]
25
26
async fn main ( ) -> Result < ( ) , io:: Error > {
@@ -115,73 +116,6 @@ async fn run_app<B: ratatui::backend::Backend>(terminal: &mut Terminal<B>) -> io
115
116
}
116
117
}
117
118
118
- fn add_info_text ( ) -> Paragraph < ' static > {
119
- let text = "🌐 🛢️ Command Line Tools to check for SQL Injection vulnerability.\n 👨💻 https://github.com/heroesofcode/inject-sql" ;
120
-
121
- let info_text = Paragraph :: new ( text)
122
- . block ( Block :: default ( ) . borders ( Borders :: ALL ) )
123
- . style ( Style :: default ( ) . fg ( Color :: Green ) ) ;
124
-
125
- return info_text;
126
- }
127
-
128
- fn add_url_block ( url : & str ) -> Paragraph < ' _ > {
129
- let url_block = Paragraph :: new ( & url[ ..] )
130
- . block (
131
- Block :: default ( )
132
- . title ( "Enter the URL" )
133
- . borders ( Borders :: ALL ) ,
134
- )
135
- . style ( Style :: default ( ) . fg ( Color :: White ) )
136
- . wrap ( Wrap { trim : true } ) ;
137
-
138
- return url_block;
139
- }
140
-
141
- fn add_type_payload_text ( ) -> Paragraph < ' static > {
142
- let text = "\n 1 - classical 1\n 2 - classical 2\n 3 - time-based\n 4 - blind 1\n 5 - blind 2\n 6 - boolean 1\n 7 - boolean 2\n 8 - Get Database\n " ;
143
-
144
- let type_payload_text = Paragraph :: new ( text) . style ( Style :: default ( ) . fg ( Color :: Green ) ) ;
145
-
146
- return type_payload_text;
147
- }
148
-
149
- fn add_payload_block ( payload_type : & str ) -> Paragraph < ' _ > {
150
- let payload_block = Paragraph :: new ( & payload_type[ ..] )
151
- . block (
152
- Block :: default ( )
153
- . title ( "Enter the payload type" )
154
- . borders ( Borders :: all ( ) ) ,
155
- )
156
- . style ( Style :: default ( ) . fg ( Color :: White ) )
157
- . wrap ( Wrap { trim : true } ) ;
158
-
159
- return payload_block;
160
- }
161
-
162
- fn add_result_block ( result_text : & str ) -> Paragraph < ' _ > {
163
- let result_block = Paragraph :: new ( & result_text[ ..] )
164
- . alignment ( Alignment :: Center )
165
- . block (
166
- Block :: default ( )
167
- . title ( "Result" )
168
- . borders ( Borders :: TOP )
169
- . style ( Style :: default ( ) . fg ( Color :: Yellow ) ) ,
170
- )
171
- . wrap ( Wrap { trim : true } ) ;
172
-
173
- return result_block;
174
- }
175
-
176
- fn add_help_text ( ) -> Paragraph < ' static > {
177
- let text = "Use TAB to switch between fields. Press ENTER to validate." ;
178
-
179
- let help_text = Paragraph :: new ( text)
180
- . style ( Style :: default ( ) . fg ( Color :: White ) ) ;
181
-
182
- return help_text;
183
- }
184
-
185
119
async fn show_result ( url : & str , payload_type : & str ) -> String {
186
120
if !url. is_empty ( ) && !payload_type. is_empty ( ) {
187
121
match validation_exist_sql_injection ( & url, & payload_type) . await {
0 commit comments