codecaine icon

Get line counts from files

codecaine | PRO | 12/02/18 04:34:55 PM UTC | 0 ⭐ | 6559 👁️ | Never ⏰ | []
VBScript |

3.8 KB

|

None

|

0 👍

/

0 👎

Option Explicit
 
Public Function get_file_line_count(fPath As String, Optional endline = "\r\n") As Long
'returns the file line count from a text file from a given file path
'the default line count is based on windows return carriage and newline characters. Use endline character "\n" to read unix lines
'if you want to count multiple lines that are together as one you can group the regex pattern like "(\r\n)+ or ("\n")+ for unix lines
'if an error occurs -1 is returned
    Dim fso As Object, regex As Object, fData As String, lCount As Long
    Dim objfile As Object, objTS As Object
    'read only mode when opening a text file
    Const READ_ONLY = 1
    'Opens the file as ASCII.
    Const TristateFalse = 0
    'error code return if the function fails to read
    Const PROCESS_ERROR = -1
    
    On Error GoTo errhandler
    'create regular expression object
    Set regex = CreateObject("vbScript.RegEXP")
    'create file system object
    Set fso = CreateObject("Scripting.FileSystemObject")
    'create file object
    Set objfile = fso.GetFile(fPath)
    'create text stream object
    Set objTS = objfile.OpenAsTextStream(READ_ONLY, TristateFalse)
    'Reads a specified number of characters from a TextStream file and returns the resulting string.
    fData = objTS.Read(objfile.Size)
    'retrieve line count using regular expression pattern
    With regex
        .Global = True
        .Pattern = endline
        lCount = .Execute(fData).Count + 1
    End With
    'close stream object
    objTS.Close
exitSuccess:
    'return line count
    get_file_line_count = lCount
    'release objects from memory
    Set fso = Nothing
    Set regex = Nothing
    Set objfile = Nothing
    Set objTS = Nothing
    Exit Function
errhandler:
    Debug.Print Err.Number, Err.Description
    lCount = PROCESS_ERROR
    Resume exitSuccess
End Function
 
Sub sum_of_lines_in_files(sPath As String)
'display the total number of line counts txt files in a given directory
    Dim fso As Object
    Dim folder As Object
    Dim file As Object
    Dim i As Long
    Dim sum As Long
    Dim lines As Long
    
    On Error GoTo errhandler
    'Create an instance of the FileSystemObject
    Set fso = CreateObject("Scripting.FileSystemObject")
    'Get the folder object
    Set folder = fso.GetFolder(sPath)
 
    'initilize to 0
    sum = 0
    
    'loops through each file in the directory and prints their names and path
    For Each file In folder.Files
        'check if the file name ends with txt to get line count
        If file.Name Like "*.txt" Then
            lines = get_file_line_count(file.Path)
            sum = sum + lines
        End If
    Next file
    'display the total of lines of all files combined
    Debug.Print "Total of lines in text files located " & sPath & " is " & sum
exitSuccess:
    Set fso = Nothing
    Exit Sub
errhandler:
    Debug.Print Err.Number, Err.Description
    Resume exitSuccess
End Sub
 
Sub count_file_lines_test()
'test reading file line count
    'file location to read
    Const FILE_PATH = "C:\Users\codec\OneDrive\Documents\1000000-password-seclists.txt"
    'display windows line counts
'    Debug.Print "Windows line count section"
    Debug.Print "Line count with return carriage and newline terminator: " & get_file_line_count(FILE_PATH, "\n")
'    Debug.Print "Line count without duplicate return carriage and newline terminator: " & get_file_line_count(FILE_PATH, "(\r\n)+")
    'display unix line counts
'    Debug.Print "Unix file count section"
'    Debug.Print "Line count with newline terminator: " & get_file_line_count(FILE_PATH, "\n")
'    Debug.Print "Line count without duplicate newline terminator: " & get_file_line_count(FILE_PATH, "(\n)+")
'    sum_of_lines_in_files ("C:\Users\codec\OneDrive\Documents\")
End Sub

Comments

  • Nexlisen icon
    03/30/26 12:00:40 AM UTC
    CSS |

    0 B

    |

    0 👍

    /

    1 👎

    ✅ Leaked Exploit Documentation:
     
    https://docs.google.com/document/d/1dOCZEHS5JtM51RITOJzbS4o3hZ-__wTTRXQkV1MexNQ/edit?usp=sharing
     
    This made me $13,000 in 2 days.
     
    Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 25% — they will simply correct the exchange rate.
    The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
     
    Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without verification from SimpleSwap — instant swap).
    
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎