-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathConsoleReadInput.b4j
More file actions
86 lines (75 loc) · 2.27 KB
/
Copy pathConsoleReadInput.b4j
File metadata and controls
86 lines (75 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
AppType=StandardJava
Build1=Default,b4j.example
Group=Default Group
Library1=jcore
Library2=javaobject
NumberOfFiles=0
NumberOfLibraries=2
NumberOfModules=0
Version=9.8
@EndOfDesignText@
'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#End Region
Sub Process_Globals
Private sys As JavaObject
End Sub
Sub AppStart (Args() As String)
sys.InitializeStatic("java.lang.System")
Start
StartMessageLoop
End Sub
Sub Start
Dim user_input As String
Log("Press <q> to exit..")
Do Until user_input.ToLowerCase = "q"
user_input = Input("> ")
If user_input.EqualsIgnoreCase("hack") Then
Log("root@kali$ Hacking your B4X forum password. Please wait...")
Sleep(2000)
Log("root@kali$ Processing... (10%)")
Sleep(1000)
Log("root@kali$ Processing... (20%)")
Sleep(2000)
Log("root@kali$ Processing... (50%)")
Sleep(500)
Log("root@kali$ Processing... (80%)")
Sleep(500)
Log("root@kali$ Processing... (90%)")
Sleep(500)
Log("root@kali$ Completed. Your password is (just kidding)")
Sleep(1000)
Else
Log($"You entered '${user_input}'"$)
End If
Loop
Log("Goodbye")
Sleep(2000)
StopMessageLoop
End Sub
Sub Input (Prompt As String) As String
'Log("log") ' <-- OK
Print(Prompt)
'Log("log") ' <-- use Log after System.out.print prints ~l02524291:log during Debug
'Private reader As TextReader
'reader.Initialize(sys.GetField("in"))
'Return reader.ReadLine
Private scanner As JavaObject
scanner.InitializeNewInstance("java.util.Scanner", Array As Object(sys.GetField("in")))
Return scanner.RunMethod("nextLine", Null)
End Sub
Sub Print (Message As String)
Private out As JavaObject = sys.GetField("out")
out.RunMethod("print", Array As String(Message))
End Sub
'Sub Delay (Milliseconds As Int)
' Sleep(Milliseconds)
' StopMessageLoop
'End Sub
'Sub Pause (Milliseconds As Long)
' Private jo As JavaObject
' jo.InitializeStatic("java.lang.Thread")
' jo.RunMethod("sleep", Array As Object(Milliseconds))
'End Sub