An aspiring hacker who harassed former CIA director John Brennan and former National Intelligence Director James R. Clapper, among others, will spend five years in federal prison.

Justin Liverman, 23, was part of a collective dubbed “Crackas With Attitude” that exposed the private online accounts of several top law enforcement officials.

It was a British teenager, known as “Cracka,” who actually broke into those accounts by impersonating either the officials themselves or employees of their service providers. Liverman and Andrew Otto Boggs, also 23, encouraged Cracka’s exploits and used the exposed information to bedevil the victims.

“These are no pranks,” Judge Gerald Bruce Lee said in sentencing Liverman Friday in Alexandria, Virginia, federal court. “This computer hacking, Crackas With Attitude, caused chaos. Your intent was clear, and that was to wreak havoc.”

It was particularly “despicable,” Lee added, that Liverman harassed the spouses and threatened the children of several targets.

Liverman, of North Carolina, chose some of the victims and drove the harassment campaigns against them. He paid for an hourly, month-long “phonebombing” campaign leaving threatening and explicit messages for former FBI deputy director Mark Giuliano. Liverman also texted Giuliano’s phone, asking about his “slut wife” and warning that he would “keep a close eye on your family, especially your son!”

Giuliano and other victims are not named in court papers, but their identities have been confirmed by officials familiar with the details of the case.

Through Giuliano’s credentials, Cracka got into the Law Enforcement Enterprise Portal, a computer system that gives agencies around the world access to unclassified but sensitive law enforcement information. Liverman requested personal details on Miami, Florida, police officers, which he then posted online.

“Liverman leveraged Cracka’s superior social engineering skills to his own ends – namely, to cause disruption/fear through harassment and to continue to perpetrate his online fraud of being an administrator of a hacking group and a successful hacker himself,” Assistant United States Attorney Joseph Longobardo wrote in his sentencing memorandum.

According to Liverman’s attorneys, Boggs was directly involved in breaking into the law enforcement databases and exposing the personal information of 20,000 people.

Liverman also encouraged Cracka to call in a bomb threat to the Palm Beach County Sheriff’s Office, saying, “hopefully they will have a shootout and kill each other.”

Other victims include Amy Hess, at the time the FBI executive assistant director for science and technology; Gregory Mecher, who is married to then-White House communications director Jen Psaki; and Harold Rosenbaum, chief executive of CIA contractor Centra Technology.

In January of 2016, Liverman claimed to have compromised NASA computer systems and gotten access to sensitive flight and employee details. The space agency spent $41,300 to figure out that all of the data exposed on Liverman’s Twitter account was fake or already publicly available.

Liverman said he thought at the time he was helping expose weaknesses in the private security of figures who guard the nation’s secrets, according to the court filings, as well as taking a stand against government overreach.

“I thought what I was doing was right in terms of political justice,” he said in court Friday. “But two years later, I realize I was completely wrong.”

Both Boggs and Liverman pleaded guilty earlier this year. Boggs was sentenced to two years in prison in June. “Cracka” is being prosecuted in the United Kingdom.

Attorneys for Liverman argued that their client showed a conscience by redacting some personal information before sending stolen emails to Wikileaks.

He was taking too much of the steroid Prednisone, attorney Jay Leiderman said in court, and lacked social skills or many real-life friends.

Referencing the HBO show “Westworld,” Liederman suggested Liverman was on a journey to maturity.

“He is traveling that maze,” Liederman said. “He’s coming towards the center of the maze, he’s coming towards self-actualization.”

Liverman has already served three months in jail after overdosing on cocaine while on supervised release, an incident Liederman tied to anxiety issues.

“I never truly knew what freedom was until I came to jail,” Liverman said in court Friday.

A computer science student, he said he hopes after his release to become a security auditor who will protect against “black hats like myself.”

The five-year sentence is the statutory maximum for conspiracy to commit offenses against the United States. Liederman and fellow defense attorney Marina Medvin called the sentence “extraordinarily excessive.”

As part of his plea agreement, Liverman has agreed to pay about $145,000 in restitution. Boggs has agreed to pay a little over $100,000. Prosecutors say the total cost to victims of responding to the various intrusions was $1.5 million.