Question
To begin writing your Perl script, open a command prompt window and switch to the C:Perl directory. Type notepad Win32.pl and press Enter . Click
To begin writing your Perl script, open a command prompt window and switch to the C:\Perl directory. Type notepad Win32.pl and press Enter. Click Yes when prompted to create a new file.
11.
In the new Notepad document, type # Win32.pl on the first line and press Enter.
12.
Use what youve learned in this chapter to write comments for documenting the program. Be sure to enter the author name, date, and a brief description of what the program does, such as the functions it accesses from the Win32 API.
13.
After your lines of documentation, press Enter several times to create blank lines for separating your comments from the program code. Then type use win32; and press Enter. (Note: Dont forget the semicolon.)
14.
You need five pieces of information (noted in the bulleted list before this activity) from the Win32 API. Attempt to write the code for getting this information, and then save the program. If you need assistance, use the following steps.
15.
Type $login = Win32::LoginName(); and press Enter. This line populates the $login variable with the information gathered from LoginName().
16.
Next, type the following lines to populate the other variables needed to complete the task, pressing Enter after each line:
17.
The following variables need to be displayed onscreen. Type the lines of code as shown, pressing Enter after each line. When youre done, your window should look similar to Figure 7-14.
Figure 7-14
Using the Win32 API from a Perl script
18.
After typing all the code, save the program, run it, and debug any errors. Figure 7-15 shows the output. Whats wrong with this report?
Figure 7-15
Running the win32.pl Perl script
19.
Spend time improving the reports formatting so that anyone reading the output could understand its meaning.
20.
Are there any improvements your group thinks should be made to the script? Explain. What other information might be beneficial for a security professional to get from this report?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started